This commit is contained in:
john 2025-05-16 16:10:01 +02:00
parent 14fd359ea8
commit a4ef2b4a20
26 changed files with 331 additions and 78 deletions

View file

@ -0,0 +1,37 @@
using Microsoft.Extensions.Logging;
namespace Femto.Common.Logs;
public static partial class LoggerExtensions
{
[LoggerMessage(
LogLevel.Error,
EventId = 1,
EventName = "FailedRequestWithException",
Message = "Request failed: {Method} {Path}, Status: {StatusCode}, TraceId: {TraceId}, Message: {Message}"
)]
public static partial void LogFailedRequest(
this ILogger logger,
Exception exception,
string method,
string path,
int statusCode,
string traceId,
string message
);
[LoggerMessage(
LogLevel.Error,
EventId = 2,
EventName = "FailedRequest",
Message = "Request failed: {Method} {Path}, Status: {StatusCode}, TraceId: {TraceId}, Message: {Message}"
)]
public static partial void LogFailedRequest(
this ILogger logger,
string method,
string path,
int statusCode,
string traceId,
string message
);
}