/// <summary> /// Creates the logger. /// </summary> /// <param name="name">The name.</param> /// <returns>ILogger.</returns> public ILogger CreateLogger(string name) { AggregateLogger logger; if (!_loggers.TryGetValue(name, out logger)) { lock (lockObject) { if (!_loggers.TryGetValue(name, out logger)) { logger = new AggregateLogger(_providers.ToArray(), name); _loggers[name] = logger; } } } return logger; }
/// <summary> /// 创建日志记录实例 /// </summary> /// <param name="name">定义日志的名称</param> /// <returns><see cref="ILogger"/></returns> public ILogger CreateLogger(string name) { if (!Loggers.TryGetValue(name, out AggregateLogger logger)) { lock (lockObject) { if (!Loggers.TryGetValue(name, out logger)) { logger = new AggregateLogger(Providers.ToArray(), name); Loggers[name] = logger; } } } return(logger); }