Ejemplo n.º 1
0
 /// <summary>
 /// 注册
 /// </summary>
 void IAutoRegister.LateConfigRegist(IServiceCollection services, ILogger logger)
 {
     ZeroAppOption.Instance.TraceOption[LogOption.Instance.Service] = MessageTraceType.None;//不需要链路信息
     services.AddSingleton <IMessageMiddleware, TraceLogMiddleware>();
     DependencyHelper.ResetLoggerFactory(builder =>
     {
         builder.ClearProviders();
         builder.Services.TryAddTransient(provider => ConfigurationHelper.Root);
         var config = ConfigurationHelper.Root.GetSection("Logging");
         builder.AddConfiguration(config);
         if (config.GetValue("Console", true))
         {
             builder.AddConsole();
         }
         builder.Services.AddSingleton <ILoggerProvider, MessageLoggerProvider>();
     });
 }