public bool IsEnabled(InbuiltLogLevel level) { switch (level) { case InbuiltLogLevel.Information: { return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Information)); } case InbuiltLogLevel.Debug: { return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Debug)); } case InbuiltLogLevel.Warning: { return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Warning)); } case InbuiltLogLevel.Error: { return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Error)); } case InbuiltLogLevel.Fatal: { return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Fatal)); } } return(false); }
private static void LogInternal(InbuiltLogger logger, InbuiltLogLevel level, Exception exception, string format, object[] objects) { if (logger.IsEnabled(level)) { logger.Log(level, exception, format, objects); } }
public void Log(InbuiltLogLevel level, Exception exception, string format, params object[] args) { string message = format; if (args != null && args.Length > 0) { message = string.Format(format, args); } string log = string.Format("{0} [{1}] {2} {3}", DateTime.Now.ToString("hh:mm:ss.ffff tt"), Thread.CurrentThread.ManagedThreadId, level, message); Console.WriteLine(log); if (exception != null) { Console.WriteLine(exception); } }
public void Log(InbuiltLogLevel level, Exception exception, string format, params object[] args) { if (IsEnabled(level) == false) { return; } switch (level) { case InbuiltLogLevel.Information: { _logger.Information(exception, format, args); break; } case InbuiltLogLevel.Debug: { _logger.Debug(exception, format, args); break; } case InbuiltLogLevel.Warning: { _logger.Warning(exception, format, args); break; } case InbuiltLogLevel.Error: { _logger.Error(exception, format, args); break; } case InbuiltLogLevel.Fatal: { _logger.Fatal(exception, format, args); break; } } }
public bool IsEnabled(InbuiltLogLevel level) { return(true); }
public void Log(InbuiltLogLevel level, Exception exception, string format, params object[] args) { // Hola }