コード例 #1
0
 protected override void Load(ContainerBuilder builder)
 {
     builder.Register(context => _logFactory);
     builder.Register(context =>
     {
         try
         {
             var configSource = context.ResolveOptional <IConfigurationSource>();
             var config       = configSource != null ? configSource.GetSection <LoggingConfig>(LoggingConfig.SectionName) : null;
             return(config ?? new LoggingConfig());
         }
         catch (ComponentNotRegisteredException registrationError)
         {
             throw ErrorBuilder.BuildContainerException(registrationError, ConfigurationResources.MissingConfigSourceErrorHint);
         }
     }).As <ILoggingConfig>();
     builder.RegisterInstance(new JsonLogValueFormatter()).As <ILogValueFormatter>();
     builder.RegisterType <LoggingInterceptor>();
 }