private static NLog.LogLevel GetLevel(LogLevel level) { switch (level) { case LogLevel.Trace: return(NLog.LogLevel.Trace); case LogLevel.Debug: return(NLog.LogLevel.Debug); case LogLevel.Info: return(NLog.LogLevel.Info); case LogLevel.Warn: return(NLog.LogLevel.Warn); case LogLevel.Error: return(NLog.LogLevel.Error); case LogLevel.Fatal: return(NLog.LogLevel.Fatal); case LogLevel.Off: return(NLog.LogLevel.Off); default: return(NLog.LogLevel.Off); } }
private static NLog.LogLevel GetLevel(LogLevel level) { switch (level) { case LogLevel.Trace: return NLog.LogLevel.Trace; case LogLevel.Debug: return NLog.LogLevel.Debug; case LogLevel.Info: return NLog.LogLevel.Info; case LogLevel.Warn: return NLog.LogLevel.Warn; case LogLevel.Error: return NLog.LogLevel.Error; case LogLevel.Fatal: return NLog.LogLevel.Fatal; case LogLevel.Off: return NLog.LogLevel.Off; default: return NLog.LogLevel.Off; } }
/// <summary> /// 获取日志输出处理委托实例 /// </summary> /// <param name="level">日志输出级别</param> /// <param name="message">日志消息</param> /// <param name="exception">日志异常</param> protected override void WriteInternal(LogLevel level, object message, Exception exception) { _logger.Log(GetLevel(level), message.ToString(), exception); }