public static int GetLoggerLevel(string loggerName)
        {
            TracingLevel level       = TracingConfiguration._currentLevel;
            int          levelLength = 0;

            return(level._levelValue);
        }
示例#2
0
        private void WriteLog(TracingLevel level, string message)
        {
            TracingEvent logEvent = new TracingEvent();

            logEvent.Message    = message;
            logEvent.LoggerName = _loggerName;
            logEvent.Level      = level;

            DoAppend(logEvent);
        }
示例#3
0
 public void InfoFmtSip(string from, string to, string callId, string cseq, string message, params object[] args)
 {
     try {
         if (TracingLevel.CanLogInfo(this))
         {
             WriteLog(TracingLevel.Info, string.Format(message, args), from, to, callId, cseq);
         }
     } catch (Exception ex) {
         Trace.Write(ex);
     }
 }
示例#4
0
 public void InfoFmtEx(Exception exception, string message, params object[] args)
 {
     try {
         if (TracingLevel.CanLogInfo(this))
         {
             WriteLog(TracingLevel.Info, string.Format(message, args), exception);
         }
     } catch (Exception ex) {
         Trace.Write(ex);
     }
 }
示例#5
0
 public void Info(string from, string to, string callId, string cseq, Exception exception, string message)
 {
     try {
         if (TracingLevel.CanLogInfo(this))
         {
             WriteLog(TracingLevel.Info, message, exception, from, to, callId, cseq);
         }
     } catch (Exception ex) {
         Trace.Write(ex);
     }
 }
示例#6
0
 public void Info(Exception exception, string message)
 {
     try {
         if (TracingLevel.CanLogInfo(this))
         {
             WriteLog(TracingLevel.Info, message, exception);
         }
     } catch (Exception ex) {
         Trace.Write(ex);
     }
 }
示例#7
0
 public void ErrorFmt(string message, params object[] args)
 {
     try {
         if (TracingLevel.CanLogError(this))
         {
             WriteLog(TracingLevel.Error, string.Format(message, args));
         }
     } catch (Exception ex) {
         Trace.Write(ex);
     }
 }
示例#8
0
 public void Error(Exception exception, string message)
 {
     try {
         if (TracingLevel.CanLogError(this))
         {
             WriteLog(TracingLevel.Error, message, exception);
         }
     } catch (Exception ex) {
         Trace.Write(ex);
     }
 }
示例#9
0
 public void Warn(Exception exception, string message)
 {
     try {
         if (TracingLevel.CanLogWarn(this))
         {
             WriteLog(TracingLevel.Warn, message, exception);
         }
     } catch (Exception ex) {
         Trace.Write(ex);
     }
 }
示例#10
0
 public void Warn(string from, string to, string callId, string cseq, string message)
 {
     try {
         if (TracingLevel.CanLogWarn(this))
         {
             WriteLog(TracingLevel.Warn, message, from, to, callId, cseq);
         }
     } catch (Exception ex) {
         Trace.Write(ex);
     }
 }
示例#11
0
        private void WriteLog(TracingLevel level, string message, string from, string to, string callId, string cseq)
        {
            TracingEvent logEvent = new TracingEvent();

            logEvent.Message    = message;
            logEvent.LoggerName = _loggerName;
            logEvent.Level      = level;
            logEvent.From       = from;
            logEvent.To         = to;
            logEvent.CallId     = callId;
            logEvent.Cseq       = cseq;

            DoAppend(logEvent);
        }
        static TracingConfiguration()
        {
            try
            {
                _defaultConfig = (TracingConfigSection)ConfigurationManager.GetSection("LoadingSkyLog");
                if (_defaultConfig == null)
                {
                    _defaultConfig = Activator.CreateInstance <TracingConfigSection>();
                }
            }
            catch {
                _defaultConfig = Activator.CreateInstance <TracingConfigSection>();
            }

            _currentLevel = TracingLevel.GetLogLevel(_defaultConfig.Level);
        }
示例#13
0
 internal static bool CanLog(TracingLevel level)
 {
     return(level._levelValue >= TracingConfiguration._currentLevel._levelValue);
 }