Пример #1
0
        bool ShouldLog(LogLevel level)
        {
            if (level == LogLevel.Error || level == LogLevel.Warning)
            {
                return(true);
            }

            return(level <= Level && !DiscardSources.Contains(Source.Name));
        }
Пример #2
0
        static void LogMessage(LogLevel level, Type source, string category,
                               string format, params object[] args)
        {
            if (level > Level || (level != LogLevel.Error &&
                                  DiscardSources.Contains(source.Name)))
            {
                return;
            }

            var msg   = args.Length != 0 ? string.Format(format, args) : format;
            var stamp = TimestampFormat != string.Empty ?
                        DateTime.Now.ToString(TimestampFormat) : string.Empty;

            lock (_lock)
                foreach (var logger in Loggers)
                {
                    logger.Log(level, stamp, source, category, msg);
                }
        }
Пример #3
0
 bool ShouldLog(LogLevel level)
 {
     return(level <= LogLevel.Warning || (level <= Level && !DiscardSources.Contains(Source.Name)));
 }