Last active
July 8, 2023 12:19
-
-
Save light-traveller/dbdb5e1816d549f95d7f8540ac17b8c4 to your computer and use it in GitHub Desktop.
Serilog config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Nuget packages: Serilog, Serilog.AspNetCore, Serilog.Sinks.Console, Serilog.Sinks.File | |
*/ | |
{ | |
"Serilog": { | |
"Using": ["Serilog.Sinks.Console", "Serilog.Sinks.File"], | |
"MinimumLevel": { | |
"Default": "Information", | |
"Override": { | |
"Microsoft": "Warning" | |
} | |
}, | |
"WriteTo": [ | |
{ | |
"Name": "Console", | |
"Args": { | |
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Literate, Serilog.Sinks.Console", | |
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}" | |
} | |
}, | |
{ | |
"Name": "File", | |
"Args": { | |
"path": "./bin/log.txt", | |
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}" | |
} | |
} | |
], | |
"Enrich": ["FromLogContext", "WithMachineName", "WithThreadId", "WithEnvironmentUserName"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added enrichers (not working by default).