I'm using Serilog ASP.NET Core for my Blazor (Server) project, I configure the logger via appsettings.json
and this is how my output template looks like:
"[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u4}] ] [{SourceContext}] {Message:lj}{NewLine}{Exception}"
I use builder.Host.UseSerilog()
to add it to the app and ILogger
to inject it into my components.
What I'd like to have is to display class name only instead of showing full assembly+class name like it does with {SourceContext}
.
Is it possible?
I already tried this one: serilog format SourceContext for showing only assembly name
After that the configuration of the logger (appsettings.json
) didn't work.
That other question has a code based approach, whereas I prefer a configuration only one via appsettings.json
.