예제 #1
0
 /// <summary>
 /// Adds a sink that sends log events via email.
 /// Can be used by the AppSettings reader.
 /// Uses the default AWS SDK credential discovery implementation.
 /// </summary>
 /// <param name="loggerConfiguration">The logger configuration.</param>
 /// <param name="emailFrom">The 'From' email address</param>
 /// <param name="emailTo">The 'To' email address</param>
 /// <param name="regionEndpoint">The AWS region endpoint for SES; must match one of the valid AWS region system names. Defaults to 'us-east-1'.</param>
 /// <param name="emailSubject">The email subject</param>
 /// <param name="isBodyHtml">True if body is HTML.  Defaults to false.</param>
 /// <param name="outputTemplate">A message template describing the format used to write to the sink.
 /// the default is "{Timestamp} [{Level}] {Message}{NewLine}{Exception}".</param>
 /// <param name="restrictedToMinimumLevel">The minimum log event level required in order to write an event to the sink.</param>
 /// <param name="batchPostingLimit">The maximum number of events to post in a single batch.</param>
 /// <param name="period">The time to wait between checking for event batches.</param>
 /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
 /// <returns>Logger configuration, allowing configuration to continue.</returns>
 /// <exception cref="ArgumentNullException">A required parameter is null.</exception>
 public static LoggerConfiguration AmazonSimpleEmailService(
     this LoggerSinkConfiguration loggerConfiguration,
     string emailFrom,
     string emailTo,
     string regionEndpoint = DefaultAwsRegionEndpoint,
     string emailSubject   = DefaultEmailSubject,
     bool isBodyHtml       = false,
     string outputTemplate = DefaultOutputTemplate,
     LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
     int batchPostingLimit          = AmazonSimpleEmailServiceSink.DefaultBatchPostingLimit,
     TimeSpan?period                = null,
     IFormatProvider formatProvider = null)
 {
     return(loggerConfiguration.AmazonSimpleEmailService(
                new AmazonSimpleEmailServiceClient(RegionEndpoint.GetBySystemName(regionEndpoint)),
                emailFrom,
                emailTo,
                emailSubject,
                isBodyHtml,
                outputTemplate,
                restrictedToMinimumLevel,
                batchPostingLimit,
                period,
                formatProvider));
 }