コード例 #1
0
 /// <summary>
 /// Adds a sink that writes log events to a table in a MSSqlServer database.
 /// Create a database and execute the table creation script found here
 /// https://gist.github.com/mivano/10429656
 /// or use the autoCreateSqlTable option.
 /// </summary>
 /// <param name="loggerAuditSinkConfiguration">The logger configuration.</param>
 /// <param name="connectionString">The connection string to the database where to store the events.</param>
 /// <param name="sinkOptions">Supplies additional settings for the sink</param>
 /// <param name="restrictedToMinimumLevel">The minimum log event level required in order to write an event to the sink.</param>
 /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
 /// <param name="columnOptions"></param>
 /// <param name="logEventFormatter">Supplies custom formatter for the LogEvent column, or null</param>
 /// <returns>Logger configuration, allowing configuration to continue.</returns>
 /// <exception cref="ArgumentNullException">A required parameter is null.</exception>
 public static LoggerConfiguration MSSqlServer(
     this LoggerAuditSinkConfiguration loggerAuditSinkConfiguration,
     string connectionString,
     SinkOptions sinkOptions = null,
     LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
     IFormatProvider formatProvider         = null,
     ColumnOptions columnOptions            = null,
     ITextFormatter logEventFormatter       = null) =>
 loggerAuditSinkConfiguration.MSSqlServerInternal(
     configSectionName: AppConfigSectionName,
     connectionString: connectionString,
     sinkOptions: sinkOptions,
     restrictedToMinimumLevel: restrictedToMinimumLevel,
     formatProvider: formatProvider,
     columnOptions: columnOptions,
     logEventFormatter: logEventFormatter,
     applySystemConfiguration: new ApplySystemConfiguration(),
     auditSinkFactory: new MSSqlServerAuditSinkFactory());