Beispiel #1
0
        private static TValue FindValueFor <TValue>(LoggerName name, Dictionary <LoggerName, TValue> valuesDictionary, object defaultValue)
        {
            TValue local = (TValue)defaultValue;

            if (valuesDictionary.Count > 0)
            {
                using (IEnumerator <LoggerName> enumerator = name.Hierarchy.GetEnumerator())
                {
                    TValue local2;
                    while (enumerator.MoveNext())
                    {
                        LoggerName current = enumerator.Current;
                        if (valuesDictionary.TryGetValue(current, out local2))
                        {
                            goto Label_0036;
                        }
                    }
                    return(local);

Label_0036:
                    local = local2;
                }
            }
            return(local);
        }
Beispiel #2
0
 private void RegisterMessageFormatterFor(LoggerName name, MessageFormatter formatter)
 {
     if (formatter == null)
     {
         throw new ArgumentNullException("formatter");
     }
     RegisterValueFor <MessageFormatter>(name, nameToMessageFormatterMapping, formatter);
 }
Beispiel #3
0
 private void RegisterLogFor(LoggerName name, Log log)
 {
     if (log == null)
     {
         throw new ArgumentNullException("log");
     }
     RegisterValueFor <Log>(name, nameToLogMapping, log);
 }
Beispiel #4
0
 public Logger(Type type)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     name           = new LoggerName(type);
     settings       = Settings.Default;
     destinationLog = settings.FindLogFor(name);
     CommonInit();
 }
Beispiel #5
0
 public Logger(string name)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentNullException("name");
     }
     this.name      = new LoggerName(name);
     settings       = Settings.Default;
     destinationLog = settings.FindLogFor(this.name);
     CommonInit();
 }
Beispiel #6
0
 public Logger(Type type, Settings settings)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (settings == null)
     {
         throw new ArgumentNullException("settings");
     }
     name           = new LoggerName(type);
     this.settings  = settings;
     destinationLog = this.settings.FindLogFor(name);
     CommonInit();
 }
Beispiel #7
0
 public Logger(Type type, Log log)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (log == null)
     {
         throw new ArgumentNullException("log");
     }
     name           = new LoggerName(type);
     settings       = Settings.Default;
     destinationLog = log;
     CommonInit();
 }
Beispiel #8
0
 public Logger(string name, Settings settings)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentNullException("name");
     }
     if (settings == null)
     {
         throw new ArgumentNullException("settings");
     }
     this.name      = new LoggerName(name);
     this.settings  = settings;
     destinationLog = this.settings.FindLogFor(this.name);
     CommonInit();
 }
Beispiel #9
0
 public Logger(string name, Log log)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentNullException("name");
     }
     if (log == null)
     {
         throw new ArgumentNullException("log");
     }
     this.name      = new LoggerName(name);
     settings       = Settings.Default;
     destinationLog = log;
     CommonInit();
 }
Beispiel #10
0
 public Logger(Type type, Log log, Settings settings)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (log == null)
     {
         throw new ArgumentNullException("log");
     }
     if (settings == null)
     {
         throw new ArgumentNullException("settings");
     }
     name           = new LoggerName(type);
     this.settings  = settings;
     destinationLog = log;
     CommonInit();
 }
Beispiel #11
0
 internal LogLevel FindLogLevelFor(LoggerName name) =>
 FindValueFor <LogLevel>(name, nameToLevelMapping, defaultLevel);
Beispiel #12
0
 internal Log FindLogFor(LoggerName name) =>
 FindValueFor <Log>(name, nameToLogMapping, defaultLog);
Beispiel #13
0
 internal ExceptionFormatter FindExceptionFormatterFor(LoggerName name) =>
 FindValueFor <ExceptionFormatter>(name, nameToExceptionFormatterMapping, DefaultFormatters.Exception);
Beispiel #14
0
 private void RegisterLogLevelFor(LoggerName name, LogLevel level)
 {
     LogLevelUtils.Valid(level, "level");
     RegisterValueFor <LogLevel>(name, nameToLevelMapping, level);
 }
Beispiel #15
0
 internal MessageFormatter FindMessageFormatterFor(LoggerName name) =>
 FindValueFor <MessageFormatter>(name, nameToMessageFormatterMapping, DefaultFormatters.Message);