Пример #1
0
 public LoggerProvider(LogegerSetting configure)
 {
     _configure = configure;
     //当配置变更,重新加载配置信息
     _configure._changeToken.RegisterChangeCallback(p =>
     {
         _configure.Reload();
         foreach (var item in LoggerProvider._loggerKeys.Keys)
         {
             initLogSetting(item);
         }
     }, null);
 }
 /// <summary>
 /// 注册LoggerProvider注册到日志工厂
 /// </summary>
 /// <param name="loggerFactory">日志工厂</param>
 /// <param name="logegerSetting">日志配置信息</param>
 /// <returns></returns>
 public static ILoggerFactory AddFile(this ILoggerFactory loggerFactory, LogegerSetting logegerSetting)
 {
     loggerFactory.AddProvider(new LoggerProvider(logegerSetting));
     return(loggerFactory);
 }