public static AWSLoggerConfigSection GetAWSLoggingConfigSection(this IConfiguration configSection, string configSectionInfoBlockName = DEFAULT_BLOCK) { var loggerConfigSection = configSection.GetSection(configSectionInfoBlockName); AWSLoggerConfigSection configObj = null; if (loggerConfigSection[AWSLoggerConfigSection.LOG_GROUP] != null) { configObj = new AWSLoggerConfigSection(loggerConfigSection); } return(configObj); }
/// <summary> /// Loads the AWS Logger Configuration from the ConfigSection /// </summary> /// <param name="configSection">ConfigSection</param> /// <param name="configSectionInfoBlockName">ConfigSection SubPath to load from</param> /// <returns></returns> public static AWSLoggerConfigSection GetAWSLoggingConfigSection(this IConfiguration configSection, string configSectionInfoBlockName = DEFAULT_BLOCK) { var loggerConfigSection = configSection.GetSection(configSectionInfoBlockName); AWSLoggerConfigSection configObj = null; if (loggerConfigSection[AWSLoggerConfigSection.LOG_GROUP] != null) { configObj = new AWSLoggerConfigSection(loggerConfigSection); } // If the code was relying on the default config block and no log group was found then // check the legacy default block. else if (string.Equals(configSectionInfoBlockName, DEFAULT_BLOCK, StringComparison.InvariantCulture)) { loggerConfigSection = configSection.GetSection(LEGACY_DEFAULT_BLOCK); if (loggerConfigSection[AWSLoggerConfigSection.LOG_GROUP] != null) { configObj = new AWSLoggerConfigSection(loggerConfigSection); } } return(configObj); }