public override bool Equals(object obj) { if (obj is MessageLevel == false) { return(false); } return(NLogLevel.Equals(((MessageLevel)obj).NLogLevel)); }
/// <summary> /// 写日志回调函数 /// </summary> /// <param name="level"></param> /// <param name="log"></param> /// <param name="len"></param> /// <returns></returns> private uint WriteLog(NLogLevel level, string log, int len) { NLog.Logger sotLog = NLog.LogManager.GetLogger("SoftTerminal"); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(sotLog); try { switch (level) { case NLogLevel.Error: logEx.Error(log); break; case NLogLevel.Warn: logEx.Warn(log); break; case NLogLevel.Info: logEx.Info(log); break; case NLogLevel.Trace: logEx.Trace(log); break; default: break; } } catch (System.Exception ex) { logEx.Error(ex, "WriteLog Exception level:{0}, log:{1}.", level, log); } return(1); }
public static EventLog EventLog(DateTime timeStamp, NLogLevel level, string logger, /*string sequenceId,*/ string address, string machineName, string windowsId, string callerSide, int lineNumber, int?threadId, string stackTrace, string message, string exception, string jsonObject) { return(new EventLog() { TimeStamp = timeStamp, Level = level, Logger = logger, //SequenceId = sequenceId, Address = address, MachineName = machineName, WindowsId = windowsId, CallerSide = callerSide, LineNumber = lineNumber, ThreadId = threadId, StackTrace = stackTrace, Message = message, Exception = exception, Json = jsonObject }); }
public override int GetHashCode() { return(NLogLevel.GetHashCode()); }
/// <summary> /// 写日志回调函数 /// </summary> /// <param name="level"></param> /// <param name="log"></param> /// <param name="len"></param> /// <returns></returns> private uint WriteLog(NLogLevel level, string log, int len) { NLog.Logger sotLog = NLog.LogManager.GetLogger("SoftTerminal"); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(sotLog); try { switch (level) { case NLogLevel.Error: logEx.Error(log); break; case NLogLevel.Warn: logEx.Warn(log); break; case NLogLevel.Info: logEx.Info(log); break; case NLogLevel.Trace: logEx.Trace(log); break; default: break; } } catch (System.Exception ex) { logEx.Error(ex, "WriteLog Exception level:{0}, log:{1}.", level, log); } return 1; }