Advertisement
nahidjamalli

Untitled

Apr 4th, 2020
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. public static ILogger CreateLogger()
  2. {
  3.             return new LoggerConfiguration()
  4.                 .WriteTo.Console()
  5.                 .WriteTo.ColoredConsole(LogEventLevel.Debug,outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}")
  6.                 .WriteTo.RollingFile(LogPath,
  7.                     retainedFileDurationLimit: TimeSpan.FromDays(2),
  8.                     restrictedToMinimumLevel: LogEventLevel.Debug,
  9.                     outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}",
  10.                     supportAsync: true,
  11.                     maxRetries: 1
  12.                 )
  13.                 .CreateLogger();
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement