Created
January 15, 2023 13:11
-
-
Save sunnamed434/50e03c8f24c7492b43e81b13a0463029 to your computer and use it in GitHub Desktop.
This file contains 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
var currentAssemblyDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); | |
var fileFormat = string.Format(Path.Combine(currentAssemblyDirectory, "logs", "bitmono-{0:yyyy-MM-dd-HH-mm-ss}.log"), DateTime.Now).Replace("\\", "/"); | |
var loggerConfiguration = new LoggerConfiguration() | |
.Enrich.FromLogContext() | |
.WriteTo.Async(configure => | |
{ | |
configure.File(fileFormat, rollingInterval: RollingInterval.Infinite, restrictedToMinimumLevel: LogEventLevel.Information, | |
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}][{SourceContext}] {Message:lj}{NewLine}{Exception}"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment