示例#1
0
        /// <summary>
        ///     记录日志
        /// </summary>
        /// <param name="loggerLevels">日志级别</param>
        /// <param name="message">日志消息</param>
        public override void Log(LoggerLevels loggerLevels, object message)
        {
            switch (loggerLevels)
            {
            case LoggerLevels.Trace:
                _logger.Trace(message);
                break;

            case LoggerLevels.Debug:
                _logger.Debug(message);
                break;

            case LoggerLevels.Info:
                _logger.Info(message);
                break;

            case LoggerLevels.Warn:
                _logger.Warn(message);
                break;

            case LoggerLevels.Error:
                _logger.Error(message);
                break;

            case LoggerLevels.Fatal:
                _logger.Fatal(message);
                break;

            default:
                break;
            }
            ExcutedOnLog(loggerLevels, message);
        }
示例#2
0
        static LogLog()
        {
            try {
                var level =
                    Environment.GetEnvironmentVariable("FF_LOGLOG_LEVEL") ?? string.Empty;
                level = level.Trim();

                LoggerLevel myLevel;
                if (level.Length == 0)
                {
                    // nop
                }
                else if (LoggerLevel.TryParse(level, out myLevel))
                {
                    WriteCore(LoggerLevel.Info,
                              LogErrorCode.InfoChangedLogLevel,
                              "Set log level: " + myLevel);
                    Levels = LoggerLevels.Above(myLevel);
                }
                else
                {
                    WriteCore(LoggerLevel.Warn,
                              LogErrorCode.InfoUnrecognizedLogLevel,
                              "Unrecognized log level: " + myLevel);
                }
            } catch (PlatformNotSupportedException) {
            } catch (SecurityException) {
            }
        }
示例#3
0
        public override void LogFormat(LoggerLevels loggerLevels, IFormatProvider formatProvider, string format,
                                       params object[] args)
        {
            var msg = string.Format(formatProvider, format, args);

            Console.WriteLine("Name:{2};Level:{0};Msg:{1}", loggerLevels, msg, Name);
        }
示例#4
0
        /// <summary>
        ///     记录日志
        /// </summary>
        /// <param name="loggerLevels">日志级别</param>
        /// <param name="message">日志消息</param>
        /// <param name="exception">异常</param>
        public override void Log(LoggerLevels loggerLevels, object message, Exception exception)
        {
            switch (loggerLevels)
            {
            case LoggerLevels.Trace:
                _logger.Trace(exception, message.ToString());
                break;

            case LoggerLevels.Debug:
                _logger.Debug(exception, message.ToString());
                break;

            case LoggerLevels.Info:
                _logger.Info(exception, message.ToString());
                break;

            case LoggerLevels.Warn:
                _logger.Warn(exception, message.ToString());
                break;

            case LoggerLevels.Error:
                _logger.Error(exception, message.ToString());
                break;

            case LoggerLevels.Fatal:
                _logger.Fatal(exception, message.ToString());
                break;

            default:
                break;
            }
            ExcutedOnLog(loggerLevels, message, exception);
        }
示例#5
0
        public override void LogFormat(LoggerLevels loggerLevels, IFormatProvider formatProvider, string format, Exception exception,
                                       params object[] args)
        {
            var msg = string.Format(formatProvider, format, args);

            Debug.WriteLine("Name:{3};Level:{0};Msg:{1};Ex:{2}", loggerLevels, msg, exception, Name);
        }
示例#6
0
        /// <summary>
        ///     记录日志
        /// </summary>
        /// <param name="loggerLevels">日志级别</param>
        /// <param name="message">格式化字符串</param>
        /// <param name="args">参数</param>
        public override void LogFormat(LoggerLevels loggerLevels, string message, params object[] args)
        {
            switch (loggerLevels)
            {
            case LoggerLevels.Trace:
                _logger.Trace(message, args);
                break;

            case LoggerLevels.Debug:
                _logger.Debug(message, args);
                break;

            case LoggerLevels.Info:
                _logger.Info(message, args);
                break;

            case LoggerLevels.Warn:
                _logger.Warn(message, args);
                break;

            case LoggerLevels.Error:
                _logger.Error(message, args);
                break;

            case LoggerLevels.Fatal:
                _logger.Fatal(message, args);
                break;

            default:
                break;
            }
            ExcutedOnLog(loggerLevels, message, args: args);
        }
        public void should_parse_pseudo_levels_star()
        {
            LoggerLevels ll = LoggerLevels.Parse("*");

            // * implies all levels are set.
            Assert.True(ll.All(kvp => kvp.Value == true));
        }
示例#8
0
        /// <summary>
        ///     记录日志
        /// </summary>
        /// <param name="loggerLevels">日志级别</param>
        /// <param name="formatProvider">格式化提供程序</param>
        /// <param name="format">格式化字符串</param>
        /// <param name="args">参数</param>
        public override void LogFormat(LoggerLevels loggerLevels, IFormatProvider formatProvider, string format,
                                       params object[] args)
        {
            switch (loggerLevels)
            {
            case LoggerLevels.Trace:
                _logger.Trace(formatProvider, format, args);
                break;

            case LoggerLevels.Debug:
                _logger.Debug(formatProvider, format, args);
                break;

            case LoggerLevels.Info:
                _logger.Info(formatProvider, format, args);
                break;

            case LoggerLevels.Warn:
                _logger.Warn(formatProvider, format, args);
                break;

            case LoggerLevels.Error:
                _logger.Error(formatProvider, format, args);
                break;

            case LoggerLevels.Fatal:
                _logger.Fatal(formatProvider, format, args);
                break;

            default:
                break;
            }
            ExcutedOnLog(loggerLevels, string.Format(formatProvider, format, args));
        }
示例#9
0
        /// <summary>
        ///     记录日志
        /// </summary>
        /// <param name="loggerLevels">日志级别</param>
        /// <param name="formatProvider">格式化提供程序</param>
        /// <param name="message">格式化字符串</param>
        /// <param name="exception">异常信息</param>
        /// <param name="args">参数</param>
        public override void LogFormat(LoggerLevels loggerLevels, IFormatProvider formatProvider, string message,
                                       Exception exception, params object[] args)
        {
            switch (loggerLevels)
            {
            case LoggerLevels.Trace:
                _logger.Trace(exception, formatProvider, message, args);
                break;

            case LoggerLevels.Debug:
                _logger.Debug(exception, formatProvider, message, args);
                break;

            case LoggerLevels.Info:
                _logger.Info(exception, formatProvider, message, args);
                break;

            case LoggerLevels.Warn:
                _logger.Warn(exception, formatProvider, message, args);
                break;

            case LoggerLevels.Error:
                _logger.Error(exception, formatProvider, message, args);
                break;

            case LoggerLevels.Fatal:
                _logger.Fatal(exception, formatProvider, message, args);
                break;

            default:
                break;
            }
            ExcutedOnLog(loggerLevels, message, args: args, ex: exception);
        }
示例#10
0
        private static void SetForegroundColor(LoggerLevels loggerLevels)
        {
            switch (loggerLevels)
            {
            case LoggerLevels.Trace:
            case LoggerLevels.Debug:
                Console.ForegroundColor = ConsoleColor.White;
                break;

            case LoggerLevels.Info:
                Console.ForegroundColor = ConsoleColor.Blue;
                break;

            case LoggerLevels.Warn:
                Console.ForegroundColor = ConsoleColor.Yellow;
                break;

            case LoggerLevels.Error:
                Console.ForegroundColor = ConsoleColor.Red;
                break;

            case LoggerLevels.Fatal:
                Console.ForegroundColor = ConsoleColor.DarkRed;
                break;

            default:
                break;
            }
        }
示例#11
0
        public override void Log(LoggerLevels loggerLevels, object message, Exception exception)
        {
            switch (loggerLevels)
            {
            case LoggerLevels.Trace:
                log.Trace(message, exception);
                break;

            case LoggerLevels.Debug:
                log.Debug(message, exception);
                break;

            case LoggerLevels.Info:
                log.Info(message, exception);
                break;

            case LoggerLevels.Warn:
                log.Warn(message, exception);
                break;

            case LoggerLevels.Error:
                log.Error(message, exception);
                break;

            case LoggerLevels.Fatal:
                log.Fatal(message, exception);
                break;

            default:
                break;
            }
            ExcuteOnLog(loggerLevels, message, exception);
        }
示例#12
0
        public override void LogFormat(LoggerLevels loggerLevels, string format, params object[] args)
        {
            switch (loggerLevels)
            {
            case LoggerLevels.Trace:
                log.TraceFormat(format, args);
                break;

            case LoggerLevels.Debug:
                log.DebugFormat(format, args);
                break;

            case LoggerLevels.Info:
                log.InfoFormat(format, args);
                break;

            case LoggerLevels.Warn:
                log.WarnFormat(format, args);
                break;

            case LoggerLevels.Error:
                log.ErrorFormat(format, args);
                break;

            case LoggerLevels.Fatal:
                log.FatalFormat(format, args);
                break;

            default:
                break;
            }
            ExcuteOnLog(loggerLevels, string.Format(format, args));
        }
示例#13
0
 public override void LogFormat(LoggerLevels loggerLevels, string format, params object[] args)
 {
     switch (loggerLevels)
     {
         case LoggerLevels.Trace:
             log.TraceFormat(format, args);
             break;
         case LoggerLevels.Debug:
             log.DebugFormat(format, args);
             break;
         case LoggerLevels.Info:
             log.InfoFormat(format, args);
             break;
         case LoggerLevels.Warn:
             log.WarnFormat(format, args);
             break;
         case LoggerLevels.Error:
             log.ErrorFormat(format, args);
             break;
         case LoggerLevels.Fatal:
             log.FatalFormat(format, args);
             break;
         default:
             break;
     }
     ExcuteOnLog(loggerLevels, string.Format(format, args));
 }
示例#14
0
 public override void Log(LoggerLevels loggerLevels, object message, Exception exception)
 {
     switch (loggerLevels)
     {
         case LoggerLevels.Trace:
             log.Trace(message, exception);
             break;
         case LoggerLevels.Debug:
             log.Debug(message, exception);
             break;
         case LoggerLevels.Info:
             log.Info(message, exception);
             break;
         case LoggerLevels.Warn:
             log.Warn(message, exception);
             break;
         case LoggerLevels.Error:
             log.Error(message, exception);
             break;
         case LoggerLevels.Fatal:
             log.Fatal(message, exception);
             break;
         default:
             break;
     }
     ExcuteOnLog(loggerLevels, message, exception);
 }
示例#15
0
 public override void Log(LoggerLevels loggerLevels, object message)
 {
     switch (loggerLevels)
     {
         case LoggerLevels.Trace:
             log.Trace(message);
             break;
         case LoggerLevels.Debug:
             log.Debug(message);
             break;
         case LoggerLevels.Info:
             log.Info(message);
             break;
         case LoggerLevels.Warn:
             log.Warn(message);
             break;
         case LoggerLevels.Error:
             log.Error(message);
             break;
         case LoggerLevels.Fatal:
             log.Fatal(message);
             break;
         //性能警告
         //TODO:需要记录性能警报信息
         case LoggerLevels.PerformanceWarn:
             log.Warn(message);
             break;
         default:
             break;
     }
     ExcuteOnLog(loggerLevels, message);
 }
        public void should_parse_pseudo_levels_off()
        {
            LoggerLevels ll = LoggerLevels.Parse("Off");

            // Off implies no level is set.
            Assert.True(ll.All(kvp => kvp.Value == false));
        }
示例#17
0
 /// <summary>
 /// Default constructor.  Hidden so instantiation must be through NewLog() methods
 /// </summary>
 public Log()
 {
     if (_lastChanceLock == null)
     {
         _lastChanceLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
     }
     DefaultLogLevels = CoreConfig.Log.LoggerLevels;
 }
示例#18
0
        public override void LogFormat(LoggerLevels loggerLevels, string format, Exception exception,
                                       params object[] args)
        {
            SetForegroundColor(loggerLevels);

            Console.WriteLine("Name:{3};Level:{0};Msg:{1};Ex:{2}", loggerLevels, string.Format(format, args), exception,
                              Name);
        }
示例#19
0
        public ConsoleColorMapping AddNew(LoggerLevels level)
        {
            ConsoleColorMapping result = new ConsoleColorMapping {
                Level = level
            };

            this.Add(result);
            return(result);
        }
 public void test_parser_parity()
 {
     foreach (LoggerLevel level in LoggerLevel.GetValues())
     {
         LoggerLevels ll = null;
         var          ex = Record.Exception(() => ll = LoggerLevels.Parse(level.ToString()));
         Assert.Null(ex);
     }
 }
示例#21
0
 public void MapLogLevel_ToString_ReturnsExpected()
 {
     Assert.Equal("OFF", LoggerLevels.MapLogLevel(LogLevel.None));
     Assert.Equal("FATAL", LoggerLevels.MapLogLevel(LogLevel.Critical));
     Assert.Equal("ERROR", LoggerLevels.MapLogLevel(LogLevel.Error));
     Assert.Equal("WARN", LoggerLevels.MapLogLevel(LogLevel.Warning));
     Assert.Equal("INFO", LoggerLevels.MapLogLevel(LogLevel.Information));
     Assert.Equal("DEBUG", LoggerLevels.MapLogLevel(LogLevel.Debug));
     Assert.Equal("TRACE", LoggerLevels.MapLogLevel(LogLevel.Trace));
 }
 protected void ExcuteOnLog(LoggerLevels loggerLevels, object message)
 {
     if (OnLog == null) return;
     var e = new LogArgs()
     {
         loggerLevels = loggerLevels,
         Message = message
     };
     OnLog(null, e);
 }
        public void test_parse_list()
        {
            LoggerLevels a = new LoggerLevels(LoggerLevel.Debug, LoggerLevel.Trace, LoggerLevel.Info);

            Assert.Equal(a, LoggerLevels.Parse("Debug, Trace, Info"));

            LoggerLevels b = new LoggerLevels(LoggerLevel.Debug, LoggerLevel.Trace, LoggerLevel.Info, LoggerLevel.Verbose);

            Assert.Equal(a, LoggerLevels.Parse("Debug\t Trace\t\r Info"));
        }
示例#24
0
        public void Constructor_SetsProperties()
        {
            LoggerLevels lv1 = new LoggerLevels(null, LogLevel.Warning);

            Assert.Null(lv1.ConfiguredLevel);
            Assert.Equal("WARN", lv1.EffectiveLevel);
            LoggerLevels lv2 = new LoggerLevels(LogLevel.Information, LogLevel.Warning);

            Assert.Equal("INFO", lv2.ConfiguredLevel);
            Assert.Equal("WARN", lv2.EffectiveLevel);
        }
示例#25
0
 public void MapLogLevel_FromString_ReturnsExpected()
 {
     Assert.Equal(LogLevel.None, LoggerLevels.MapLogLevel("OFF"));
     Assert.Equal(LogLevel.Critical, LoggerLevels.MapLogLevel("FATAL"));
     Assert.Equal(LogLevel.Error, LoggerLevels.MapLogLevel("ERROR"));
     Assert.Equal(LogLevel.Warning, LoggerLevels.MapLogLevel("WARN"));
     Assert.Equal(LogLevel.Information, LoggerLevels.MapLogLevel("INFO"));
     Assert.Equal(LogLevel.Debug, LoggerLevels.MapLogLevel("DEBUG"));
     Assert.Equal(LogLevel.Trace, LoggerLevels.MapLogLevel("TRACE"));
     Assert.Null(LoggerLevels.MapLogLevel("FooBar"));
 }
示例#26
0
        public void Log(LoggerLevels loggerLevels, object message, Exception ex)
        {
            EnsureProxyExists();

            if (_proxy != null)
            {
                if (ex != null)
                    _proxy.Invoke(MethodName, loggerLevels, message, ex);
                else
                    _proxy.Invoke(MethodName, loggerLevels, message);
            }
        }
示例#27
0
        protected void ExcuteOnLog(LoggerLevels loggerLevels, object message)
        {
            if (OnLog == null)
            {
                return;
            }
            var e = new LogArgs()
            {
                loggerLevels = loggerLevels,
                Message      = message
            };

            OnLog(null, e);
        }
示例#28
0
 /// <summary>
 /// Create a new log with a specific name and specific logging level.
 /// </summary>
 /// <param name="logName">Name of log (in logging system).  May not map to actual operating system file name</param>
 /// <param name="logLevels">Amount of logging this log will do</param>
 /// <returns>Created log or cached instance if already created one in application domain</returns>
 public static Log NewLog(string logName, LoggerLevels logLevels)
 {
     if (_dictionary.ContainsKey(logName) == true)
     {
         _dictionary[logName].SetLogLevel(logLevels, true);
         return(_dictionary[logName]);
     }
     else
     {
         Log log = new Log(logName, logLevels);
         _dictionary[logName] = log;
         return(log);
     }
 }
示例#29
0
        /// <summary>
        ///     记录日志完成时执行,以触发日志事件
        /// </summary>
        /// <param name="loggerLevels">日志等级</param>
        /// <param name="message">日志消息</param>
        /// <param name="ex">异常信息</param>
        protected void ExcutedOnLog(LoggerLevels loggerLevels, object message, Exception ex = null)
        {
            if (OnLog == null)
            {
                return;
            }
            var e = new LogEventArgs
            {
                Exception    = ex,
                LoggerLevels = loggerLevels,
                Message      = message
            };

            OnLog(null, e);
        }
示例#30
0
        public void Log(LoggerLevels loggerLevels, object message, Exception ex)
        {
            EnsureProxyExists();

            if (_proxy != null)
            {
                if (ex != null)
                {
                    _proxy.Invoke(MethodName, loggerLevels, message, ex);
                }
                else
                {
                    _proxy.Invoke(MethodName, loggerLevels, message);
                }
            }
        }
示例#31
0
        public override void Log(LoggerLevels loggerLevels, object message)
        {
            try
            {
                switch (loggerLevels)
                {
                case LoggerLevels.Trace:
                    log.Trace(message);
                    break;

                case LoggerLevels.Debug:
                    log.Debug(message);
                    break;

                case LoggerLevels.Info:
                    log.Info(message);
                    break;

                case LoggerLevels.Warn:
                    log.Warn(message);
                    break;

                case LoggerLevels.Error:
                    log.Error(message);
                    break;

                case LoggerLevels.Fatal:
                    log.Fatal(message);
                    break;

                //性能警告
                //TODO:需要记录性能警报信息
                case LoggerLevels.PerformanceWarn:
                    log.Warn(message);
                    break;

                default:
                    break;
                }
                ExcuteOnLog(loggerLevels, message);
            }
            catch (Exception)
            {
            }
        }
示例#32
0
        public Log(string sourceName, LoggerLevels levels)
        {
            LogName = sourceName;

            //-------------------------------------------------------
            // wire-up default writers.  Applications might use
            // these events to hook into the event processing
            //  (e.g. have events log to a text box)
            //-------------------------------------------------------
            OnLogDebugEventHandler       += writeDebug;
            OnLogErrorEventHandler       += writeError;
            OnLogCriticalEventHandler    += writeCritical;
            OnLogInformationEventHandler += writeInformation;
            OnLogTraceEventHandler       += writeTrace;
            OnLogWarningEventHandler     += writeWarning;

            SetLogLevel(levels, true); //turn on logging for Warning,Error,Critical
        }
示例#33
0
        public void Write(string message, LoggerLevels level)
        {
            //skip messages that are outside of our logging scope
            if (level > LoggerLevel)
            {
                return;
            }

            //log the message
            try
            {
                File.AppendAllText(LogFilePath,
                                   string.Format("{0} -- {1} -- {2}{3}",
                                                 DateTime.Now.ToString(),
                                                 level.ToString(),
                                                 message, Environment.NewLine));
            }
            catch { }
        }
示例#34
0
        public override void LogFormat(LoggerLevels loggerLevels, IFormatProvider formatProvider, string format, Exception exception, params object[] args)
        {
            try
            {
                switch (loggerLevels)
                {
                case LoggerLevels.Trace:
                    log.TraceFormat(formatProvider, format, exception, args);
                    break;

                case LoggerLevels.Debug:
                    log.DebugFormat(formatProvider, format, exception, args);
                    break;

                case LoggerLevels.Info:
                    log.InfoFormat(formatProvider, format, exception, args);
                    break;

                case LoggerLevels.Warn:
                    log.WarnFormat(formatProvider, format, exception, args);
                    break;

                case LoggerLevels.Error:
                    log.ErrorFormat(formatProvider, format, exception, args);
                    break;

                case LoggerLevels.Fatal:
                    log.FatalFormat(formatProvider, format, exception, args);
                    break;

                default:
                    break;
                }
                ExcuteOnLog(loggerLevels, string.Format(formatProvider, format, args), exception);
            }
            catch (Exception)
            {
            }
        }
示例#35
0
 /// <summary>
 /// Create a default logger using full name of type (pattern from NHibernate).  (Default log level is set in .config ScrimpNet.Diagnostics.LoggerLevels, Default:Vital)
 /// </summary>
 /// <param name="logLevels">List of levels (flags) of message severity to log</param>
 /// <param name="type">Type that will be using this logger</param>
 /// <returns>Instance of logger</returns>
 public static Log NewLog(Type type, LoggerLevels logLevels)
 {
     return(NewLog(type.FullName, logLevels));
 }
示例#36
0
 public override void LogFormat(LoggerLevels loggerLevels, IFormatProvider formatProvider, string format, Exception exception, params object[] args)
 {
     try
     {
         switch (loggerLevels)
         {
             case LoggerLevels.Trace:
                 log.TraceFormat(formatProvider, format, exception, args);
                 break;
             case LoggerLevels.Debug:
                 log.DebugFormat(formatProvider, format, exception, args);
                 break;
             case LoggerLevels.Info:
                 log.InfoFormat(formatProvider, format, exception, args);
                 break;
             case LoggerLevels.Warn:
                 log.WarnFormat(formatProvider, format, exception, args);
                 break;
             case LoggerLevels.Error:
                 log.ErrorFormat(formatProvider, format, exception, args);
                 break;
             case LoggerLevels.Fatal:
                 log.FatalFormat(formatProvider, format, exception, args);
                 break;
             default:
                 break;
         }
         ExcuteOnLog(loggerLevels, string.Format(formatProvider, format, args), exception);
     }
     catch (Exception)
     {
     }
 }
示例#37
0
 /// <summary>
 /// Create a new log with a specific name and specific logging level.
 /// </summary>
 /// <param name="logName">Name of log (in logging system).  May not map to actual operating system file name</param>
 /// <param name="logLevels">Amount of logging this log will do</param>
 /// <returns>Created log or cached instance if already created one in application domain</returns>
 public static Log NewLog(string logName, LoggerLevels logLevels)
 {
     if (_dictionary.ContainsKey(logName) == true)
     {
         _dictionary[logName].SetLogLevel(logLevels, true);
         return _dictionary[logName];
     }
     else
     {
         Log log = new Log(logName, logLevels);
         _dictionary[logName] = log;
         return log;
     }
 }
 public abstract void LogFormat(LoggerLevels loggerLevels, IFormatProvider formatProvider, string format, Exception exception
                     , params object[] args);
示例#39
0
        /// <summary>
        /// Default constructor.  Hidden so instantiation must be through NewLog() methods
        /// </summary>
        public Log()
        {

            if (_lastChanceLock == null)
            {
                _lastChanceLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
            }
			DefaultLogLevels = CoreConfig.Log.LoggerLevels;
        }
 public abstract void Log(LoggerLevels loggerLevels, object message, Exception exception);
 public abstract void LogFormat(LoggerLevels loggerLevels, string format, params object[] args);
 public abstract void Log(LoggerLevels loggerLevels, object message);
示例#43
0
文件: Log.cs 项目: patricker/Pulse
        public void Write(string message, LoggerLevels level)
        {
            //skip messages that are outside of our logging scope
            if (level > LoggerLevel) return;

            //log the message
            try
            {
                File.AppendAllText(LogFilePath,
                    string.Format("{0} -- {1} -- {2}{3}",
                        DateTime.Now.ToString(),
                        level.ToString(),
                        message, Environment.NewLine));
            }
            catch { }
        }
示例#44
0
 /// <summary>
 /// Default constructor for Logger. This constructor is protected due to the class being abstract.
 /// </summary>
 protected Logger()
 {
     // By default, log everything.
     Level = LoggerLevels.Info;
     _disposed = false;
 }
示例#45
0
		/// <summary>
		/// Create a default logger using full name of type (pattern from NHibernate).  (Default log level is set in .config ScrimpNet.Diagnostics.LoggerLevels, Default:Vital)
		/// </summary>
		/// <param name="logLevels">List of levels (flags) of message severity to log</param>
		/// <param name="type">Type that will be using this logger</param>
		/// <returns>Instance of logger</returns>
		public static Log NewLog(Type type, LoggerLevels logLevels)
		{
			return NewLog(type.FullName, logLevels);

		}
示例#46
0
        public Log(string sourceName, LoggerLevels levels)
        {
            LogName = sourceName;

            //-------------------------------------------------------
            // wire-up default writers.  Applications might use
            // these events to hook into the event processing
            //  (e.g. have events log to a text box)
            //-------------------------------------------------------
            OnLogDebugEventHandler += writeDebug;
            OnLogErrorEventHandler += writeError;
            OnLogCriticalEventHandler += writeCritical;
            OnLogInformationEventHandler += writeInformation;
            OnLogTraceEventHandler += writeTrace;
            OnLogWarningEventHandler += writeWarning;
          
            SetLogLevel(levels, true); //turn on logging for Warning,Error,Critical
        }