示例#1
0
        public IConfigurationSection GetLoggerConfig()
        {
            var conf = _appConfiguration?.GetSection("Serilog");

            if (conf != null && conf.GetChildren().Any())
            {
                return(conf);
            }

            var defaultConfig = new Dictionary <string, string>()
            {
                ["Serilog:MinimumLevel"] = MinimumLevel,
                ["Serilog:Using:0"]      = "Serilog.Sinks.ColoredConsole",

                ["Serilog:WriteTo:0:Name"] = "ColoredConsole",
                ["Serilog:WriteTo:0:Args:outputTemplate"] = "{Timestamp:yyyy.MM.dd HH:mm:ss} [{Level:u3}] {Message}{NewLine}{Exception}",

                ["Serilog:WriteTo:1:Name"]                = "RollingFile",
                ["Serilog:WriteTo:1:Args:pathFormat"]     = "logs\\log-{Date}.log",
                ["Serilog:WriteTo:1:Args:outputTemplate"] = "{Timestamp:yyyy.MM.dd HH:mm:ss} [{Level:u3}] {Message}{NewLine}{Exception}",
            };

            return(new ConfigurationBuilder()
                   .AddInMemoryCollection(defaultConfig)
                   .Build()
                   .GetSection("Serilog"));
        }
 public IAppConfigurationSection GetSection(string key)
 {
     return(root.GetSection(AppConfigurationPath.Combine(Path, key)));
 }
示例#3
0
 public ExternalAuthVkOwinHostingModule(IAppConfiguration appConfiguration)
 {
     _settings = appConfiguration.GetSection <ExternalAuthVkOwinHostingModuleSettings>(ExternalAuthVkOwinHostingModuleSettings.SectionName);
 }
 public static string GetConnectionString(this IAppConfiguration configuration, string name)
 {
     return(configuration?.GetSection(ConnectionStringsAppConfigurationSection.SectionKey)?[name]);
 }
 public CookieAuthOwinHostingModule(IAppConfiguration appConfiguration)
 {
     _settings = appConfiguration.GetSection <CookieAuthOwinHostingModuleSettings>(CookieAuthOwinHostingModuleSettings.SectionName);
 }