Closed stefc closed 7 years ago
How I get the name of the Logger class in SeriLog dump out? The EventId I get with a property. But If I created a Logger
factory.CreateLogger<MySampleService>()
I want to see something like "MySampleService" in my output?
Microsoft default implementation writes
info: MySampleService[4711] Framework: .NET Core 4.6.24410.01 fail: MySampleService[4711] Error System.ArgumentException: Wrong Argument System.ArgumentException: Wrong Argument
With the Serilog Provider I get
2016-11-24 11:12:02 { Id: 4711 } [Information] OS: "Microsoft Windows 6.1.7601 S" 2016-11-24 11:12:02 { Id: 4711 } [Information] Framework: ".NET Core 4.6.24410.01" 2016-11-24 11:12:02 { Id: 4711 } [Error] Error "System.ArgumentException: Wrong Argument" System.ArgumentException: Wrong Argument
.WriteTo.ColoredConsole( LogEventLevel.Verbose, "{Timestamp:yyyy-MM-dd HH:mm:ss} {EventId} [{Level}] {Message}{NewLine}{Exception}")
@stefc , you need include {SourceContext} to output template.
{SourceContext}
@skomis-mm Thanks this is what I look for!
How I get the name of the Logger class in SeriLog dump out? The EventId I get with a property. But If I created a Logger
factory.CreateLogger<MySampleService>()
I want to see something like "MySampleService" in my output?
Microsoft default implementation writes
With the Serilog Provider I get