private void Log(NLogSelf.LogLevel level, int eventId, Exception exception, string message) { if (_innerLogger.IsEnabled(level)) { var eventInfo = NLogSelf.LogEventInfo.Create(level, _innerLogger.Name, message); eventInfo.Exception = exception; eventInfo.Properties["EventId"] = eventId; eventInfo.Properties["EventId.Id"] = eventId; _innerLogger.Log(eventInfo); } }
public LogNLog(string name) { this.name = name; loger = NLog.LogManager.GetLogger(name); IsDebugEnabled = loger.IsDebugEnabled; IsInfoEnabled = loger.IsInfoEnabled; IsWarnEnabled = loger.IsWarnEnabled; IsErrorEnabled = loger.IsErrorEnabled; IsFatalEnabled = loger.IsFatalEnabled; IsTraceEnabled = loger.IsEnabled(LogLevel.Trace); }
public LogNLog(string name, Func <string> getAlias) { this.name = name; loger = LogManager.GetLogger(name); this.getAlias = getAlias; IsDebugEnabled = loger.IsDebugEnabled; IsInfoEnabled = loger.IsInfoEnabled; IsWarnEnabled = loger.IsWarnEnabled; IsErrorEnabled = loger.IsErrorEnabled; IsFatalEnabled = loger.IsFatalEnabled; IsTraceEnabled = loger.IsEnabled(LogLevel.Trace); }
private void log(Exception exception, LogTag[] tag, string format, string function, object[] args, NLog.LogLevel level, string data = null) { if (logger.IsEnabled(level)) { if (data.IsEmpty()) { runLog(exception, tag, format, function, args, level, data); } else { Task.Run(() => { runLog(exception, tag, format, function, args, level, data); }); } } }
public bool IsEnabled(LogLevel logLevel) { return(_logger.IsEnabled(GetLogLevel(logLevel))); }