in src/AWS.Logger.AspNetCore/AWSLoggerConfigSection.cs [146:234]
public AWSLoggerConfigSection(IConfiguration loggerConfigSection)
{
Config.LogGroup = loggerConfigSection[LOG_GROUP];
Config.DisableLogGroupCreation = loggerConfigSection.GetValue<bool>(DISABLE_LOG_GROUP_CREATION);
Config.NewLogGroupRetentionInDays = loggerConfigSection.GetValue<int?>(NEW_LOG_GROUP_RETENTION_IN_DAYS);
if (loggerConfigSection[REGION] != null)
{
Config.Region = loggerConfigSection[REGION];
}
if (loggerConfigSection[SERVICEURL] != null)
{
Config.ServiceUrl = loggerConfigSection[SERVICEURL];
}
if (loggerConfigSection[PROFILE] != null)
{
Config.Profile = loggerConfigSection[PROFILE];
}
if (loggerConfigSection[PROFILE_LOCATION] != null)
{
Config.ProfilesLocation = loggerConfigSection[PROFILE_LOCATION];
}
if (loggerConfigSection[BATCH_PUSH_INTERVAL] != null)
{
Config.BatchPushInterval = TimeSpan.FromMilliseconds(Int32.Parse(loggerConfigSection[BATCH_PUSH_INTERVAL]));
}
if (loggerConfigSection[BATCH_PUSH_SIZE_IN_BYTES] != null)
{
Config.BatchSizeInBytes = Int32.Parse(loggerConfigSection[BATCH_PUSH_SIZE_IN_BYTES]);
}
if (loggerConfigSection[MAX_QUEUED_MESSAGES] != null)
{
Config.MaxQueuedMessages = Int32.Parse(loggerConfigSection[MAX_QUEUED_MESSAGES]);
}
if (loggerConfigSection[LOG_STREAM_NAME_SUFFIX] != null)
{
Config.LogStreamNameSuffix = loggerConfigSection[LOG_STREAM_NAME_SUFFIX];
}
if (loggerConfigSection[LOG_STREAM_NAME_PREFIX] != null)
{
Config.LogStreamNamePrefix = loggerConfigSection[LOG_STREAM_NAME_PREFIX];
}
if (loggerConfigSection[LIBRARY_LOG_FILE_NAME] != null)
{
Config.LibraryLogFileName = loggerConfigSection[LIBRARY_LOG_FILE_NAME];
}
if (loggerConfigSection[LIBRARY_LOG_ERRORS] != null)
{
Config.LibraryLogErrors = Boolean.Parse(loggerConfigSection[LIBRARY_LOG_ERRORS]);
}
if (loggerConfigSection[FLUSH_TIMEOUT] != null)
{
Config.FlushTimeout = TimeSpan.FromMilliseconds(Int32.Parse(loggerConfigSection[FLUSH_TIMEOUT]));
}
if (loggerConfigSection[AUTHENTICATION_REGION] != null)
{
Config.AuthenticationRegion = loggerConfigSection[AUTHENTICATION_REGION];
}
if (loggerConfigSection[INCLUDE_LOG_LEVEL_KEY] != null)
{
this.IncludeLogLevel = Boolean.Parse(loggerConfigSection[INCLUDE_LOG_LEVEL_KEY]);
}
if (loggerConfigSection[INCLUDE_CATEGORY_KEY] != null)
{
this.IncludeCategory = Boolean.Parse(loggerConfigSection[INCLUDE_CATEGORY_KEY]);
}
if (loggerConfigSection[INCLUDE_NEWLINE_KEY] != null)
{
this.IncludeNewline = Boolean.Parse(loggerConfigSection[INCLUDE_NEWLINE_KEY]);
}
if (loggerConfigSection[INCLUDE_EXCEPTION_KEY] != null)
{
this.IncludeException = Boolean.Parse(loggerConfigSection[INCLUDE_EXCEPTION_KEY]);
}
if (loggerConfigSection[INCLUDE_EVENT_ID_KEY] != null)
{
this.IncludeEventId = Boolean.Parse(loggerConfigSection[INCLUDE_EVENT_ID_KEY]);
}
if (loggerConfigSection[INCLUDE_SCOPES_KEY] != null)
{
this.IncludeScopes = Boolean.Parse(loggerConfigSection[INCLUDE_SCOPES_KEY]);
}
var logLevels = loggerConfigSection.GetSection(LOG_LEVEL);
if (logLevels?.GetChildren().Any() == true)
{
this.LogLevels = logLevels;
}
}