/// <summary> /// 记录日志 /// </summary> /// <param name="loggerLevels">日志级别</param> /// <param name="message">日志消息</param> public override void Log(LoggerLevels loggerLevels, object message) { switch (loggerLevels) { case LoggerLevels.Trace: _logger.Trace(message); break; case LoggerLevels.Debug: _logger.Debug(message); break; case LoggerLevels.Info: _logger.Info(message); break; case LoggerLevels.Warn: _logger.Warn(message); break; case LoggerLevels.Error: _logger.Error(message); break; case LoggerLevels.Fatal: _logger.Fatal(message); break; default: break; } ExcutedOnLog(loggerLevels, message); }
/// <summary> /// 写入日志 /// </summary> /// <param name="info"></param> protected override void Write(T info) { switch (info.Sevenrity) { case Sevenrity.Debug: if (_logger.IsDebugEnabled) { _logger.Debug(info); } break; case Sevenrity.Error: if (_logger.IsErrorEnabled) { _logger.Error(info); } break; case Sevenrity.Fatal: if (_logger.IsFatalEnabled) { _logger.Fatal(info); } break; case Sevenrity.Info: if (_logger.IsInfoEnabled) { _logger.Info(info); } break; case Sevenrity.Trace: if (_logger.IsWarnEnabled) { _logger.Info(info); } break; case Sevenrity.Warn: if (_logger.IsWarnEnabled) { _logger.Warn(info); } break; } }
public static void Main(string[] args) { try { SetupLogging(); CreateWebHostBuilder(args).Build().Run(); } catch (Exception e) { Console.Error.WriteLine("ERROR: " + e.Message); Console.Error.WriteLine(e.StackTrace); _Log?.Fatal(e, "Unhandled exception!"); Environment.Exit(254); } Environment.Exit(0); }
public void Fatal(string msg) => nLogger.Fatal(msg);
public void Fatal(string message) { logger.Fatal(message); }
/// <inheritdoc/> public void Critical(string message) => _log.Fatal(message);
public void Fatal(Exception exception) { _logger.Fatal(exception); }
public void Fatal(LogOutputProvider messageProvider) { _log.Fatal(ToGenerator(messageProvider)); }