Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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);
             });
         }
     }
 }
Ejemplo n.º 5
0
 public bool IsEnabled(LogLevel logLevel)
 {
     return(_logger.IsEnabled(GetLogLevel(logLevel)));
 }