in src/AWS.Logger.Core/Core/AWSLoggerCore.cs [93:134]
public AWSLoggerCore(AWSLoggerConfig config, string logType)
{
_config = config;
_logType = logType;
var awsConfig = new AmazonCloudWatchLogsConfig();
if (!string.IsNullOrWhiteSpace(_config.ServiceUrl))
{
var serviceUrl = _config.ServiceUrl.Trim();
awsConfig.ServiceURL = serviceUrl;
if (serviceUrl.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
{
awsConfig.UseHttp = true;
}
}
else
{
if (!string.IsNullOrEmpty(_config.Region))
{
awsConfig.RegionEndpoint = Amazon.RegionEndpoint.GetBySystemName(_config.Region);
}
}
if (!string.IsNullOrEmpty(_config.AuthenticationRegion))
{
awsConfig.AuthenticationRegion = _config.AuthenticationRegion;
}
_client = new Lazy<IAmazonCloudWatchLogs>(() =>
{
var credentials = DetermineCredentials(config);
var client = new AmazonCloudWatchLogsClient(credentials, awsConfig);
client.BeforeRequestEvent += ServiceClientBeforeRequestEvent;
client.ExceptionEvent += ServiceClienExceptionEvent;
return client;
});
StartMonitor();
RegisterShutdownHook();
}