hi everyone how can i get this output
{
"@t": "2020-11-03T16:40:21.6133998Z",
"@m": "HTTP \"POST\" \"/api/Email/SendEmail\" responded 200 in 1.0358 ms",
"@i": "62d0885c",
"CorrelationId": "",
"Host": "localhost:32768",
"Protocol": "HTTP/1.1",
"Scheme": "http",
"ContentType": null,
"EndpointName": "Email.Controllers.EmailController.SendEmail (Email)",
"RequestMethod": "POST",
"RequestPath": "/api/Email/SendEmail",
"StatusCode": 200,
"Elapsed": 1.0358,
"SourceContext": "Serilog.AspNetCore.RequestLoggingMiddleware",
"RequestId": "",
"SpanId": "|55f14a36-4918a3efd4f265b9.",
"TraceId": "55f14a36-4918a3efd4f265b9",
"ParentId": "",
"ConnectionId": "0HM402S7EC249"
}
but when i invoke my controller i see and run application i see that
thats class how i setting my Serilog,what i do wrong
public class LogConfig
{
public static void Configure()
{
Log.Logger = new LoggerConfiguration()
.WriteTo.Console(new RenderedCompactJsonFormatter())
.CreateLogger();
}
public static void EnrichFromRequest(IDiagnosticContext diagnosticContext, HttpContext httpContext)
{
diagnosticContext.Set("RequestScheme", httpContext.Request.Host.Value);
diagnosticContext.Set("Headers", httpContext.Request.Scheme);
}
}
PS
thanks in advance :)