Skip to content

Commit a04645f

Browse files
authored
Merge pull request #317 from jonorossi/rename-and-move-sinkoptions
Rename SinkOptions to MSSqlServerSinkOptions and change namespace
2 parents 930459c + 3e83aaf commit a04645f

File tree

53 files changed

+413
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+413
-431
lines changed

README.md

Lines changed: 20 additions & 21 deletions
Large diffs are not rendered by default.

sample/AppConfigDemo/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Threading;
33
using Serilog;
44
using Serilog.Events;
5-
using Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options;
5+
using Serilog.Sinks.MSSqlServer;
66

77
namespace AppConfigDemo
88
{
@@ -29,11 +29,11 @@ public static void Main()
2929
// logEventFormatter: null)
3030
// .CreateLogger();
3131

32-
// New SinkOptions based interface
32+
// New MSSqlServerSinkOptions based interface
3333
Log.Logger = new LoggerConfiguration().WriteTo
3434
.MSSqlServer(
3535
connectionString: _connectionString,
36-
sinkOptions: new SinkOptions
36+
sinkOptions: new MSSqlServerSinkOptions
3737
{
3838
TableName = _tableName,
3939
SchemaName = _schemaName,

sample/CombinedConfigDemo/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Threading;
33
using Microsoft.Extensions.Configuration;
44
using Serilog;
5-
using Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options;
5+
using Serilog.Sinks.MSSqlServer;
66

77
namespace CombinedConfigDemo
88
{
@@ -38,7 +38,7 @@ public static void Main()
3838
Log.Logger = new LoggerConfiguration()
3939
.WriteTo.MSSqlServer(
4040
connectionString: _connectionStringName,
41-
sinkOptions: new SinkOptions
41+
sinkOptions: new MSSqlServerSinkOptions
4242
{
4343
TableName = _tableName,
4444
SchemaName = _schemaName,

sample/CustomLogEventFormatterDemo/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Threading;
33
using Serilog;
44
using Serilog.Sinks.MSSqlServer;
5-
using Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options;
65

76
namespace CustomLogEventFormatterDemo
87
{
@@ -34,10 +33,10 @@ public static void Main()
3433
// logEventFormatter: customFormatter)
3534
// .CreateLogger();
3635

37-
// New SinkOptions based interface
36+
// New MSSqlServerSinkOptions based interface
3837
Log.Logger = new LoggerConfiguration()
3938
.WriteTo.MSSqlServer(_connectionString,
40-
sinkOptions: new SinkOptions
39+
sinkOptions: new MSSqlServerSinkOptions
4140
{
4241
TableName = _tableName,
4342
SchemaName = _schemaName,

sample/NetStandardDemo/NetStandardDemoLib/Initializer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Serilog;
44
using Serilog.Events;
55
using Serilog.Sinks.MSSqlServer;
6-
using Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options;
76

87
namespace NetStandardDemoLib
98
{
@@ -18,7 +17,7 @@ public static LoggerConfiguration CreateLoggerConfiguration()
1817
.Enrich.FromLogContext()
1918
.WriteTo.MSSqlServer(
2019
_connectionString,
21-
new SinkOptions
20+
new MSSqlServerSinkOptions
2221
{
2322
TableName = _tableName,
2423
AutoCreateSqlTable = true

src/Serilog.Sinks.MSSqlServer/Configuration/Extensions/Hybrid/LoggerConfigurationMSSqlServerExtensions.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using Serilog.Formatting;
2121
using Serilog.Sinks.MSSqlServer;
2222
using Serilog.Sinks.MSSqlServer.Configuration.Factories;
23-
using Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options;
2423

2524
// The "Hybrid" configuration system supports both Microsoft.Extensions.Configuration and System.Configuration.
2625
// This is necessary because .NET Framework 4.6.1+ and .NET Core 2.0+ apps support both approaches, whereas the
@@ -44,7 +43,7 @@ public static class LoggerConfigurationMSSqlServerExtensions
4443
/// https://gist.github.com/mivano/10429656
4544
/// or use the autoCreateSqlTable option.
4645
///
47-
/// Note: this is the legacy version of the extension method. Please use the new one using SinkOptions instead.
46+
/// Note: this is the legacy version of the extension method. Please use the new one using MSSqlServerSinkOptions instead.
4847
///
4948
/// </summary>
5049
/// <param name="loggerConfiguration">The logger configuration.</param>
@@ -62,7 +61,7 @@ public static class LoggerConfigurationMSSqlServerExtensions
6261
/// <param name="logEventFormatter">Supplies custom formatter for the LogEvent column, or null</param>
6362
/// <returns>Logger configuration, allowing configuration to continue.</returns>
6463
/// <exception cref="ArgumentNullException">A required parameter is null.</exception>
65-
[Obsolete("Use the new interface accepting a SinkOptions parameter instead. This will be removed in a future release.", error: false)]
64+
[Obsolete("Use the new interface accepting a MSSqlServerSinkOptions parameter instead. This will be removed in a future release.", error: false)]
6665
public static LoggerConfiguration MSSqlServer(
6766
this LoggerSinkConfiguration loggerConfiguration,
6867
string connectionString,
@@ -79,9 +78,9 @@ public static LoggerConfiguration MSSqlServer(
7978
ITextFormatter logEventFormatter = null)
8079
{
8180
// Do not add new parameters here. This interface is considered legacy and will be deprecated in the future.
82-
// For adding new input parameters use the SinkOptions class and the method overload that accepts SinkOptions.
81+
// For adding new input parameters use the MSSqlServerSinkOptions class and the method overload that accepts MSSqlServerSinkOptions.
8382

84-
var sinkOptions = new SinkOptions(tableName, batchPostingLimit, period, autoCreateSqlTable, schemaName);
83+
var sinkOptions = new MSSqlServerSinkOptions(tableName, batchPostingLimit, period, autoCreateSqlTable, schemaName);
8584

8685
return loggerConfiguration.MSSqlServer(
8786
connectionString: connectionString,
@@ -116,7 +115,7 @@ public static LoggerConfiguration MSSqlServer(
116115
public static LoggerConfiguration MSSqlServer(
117116
this LoggerSinkConfiguration loggerConfiguration,
118117
string connectionString,
119-
SinkOptions sinkOptions = null,
118+
MSSqlServerSinkOptions sinkOptions = null,
120119
IConfigurationSection sinkOptionsSection = null,
121120
IConfiguration appConfiguration = null,
122121
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
@@ -143,7 +142,7 @@ public static LoggerConfiguration MSSqlServer(
143142
internal static LoggerConfiguration MSSqlServerInternal(
144143
this LoggerSinkConfiguration loggerConfiguration,
145144
string connectionString,
146-
SinkOptions sinkOptions,
145+
MSSqlServerSinkOptions sinkOptions,
147146
IConfigurationSection sinkOptionsSection,
148147
IConfiguration appConfiguration,
149148
LogEventLevel restrictedToMinimumLevel,
@@ -172,7 +171,7 @@ internal static LoggerConfiguration MSSqlServerInternal(
172171
/// <summary>
173172
/// Adds a sink that writes log events to a table in a MSSqlServer database.
174173
///
175-
/// Note: this is the legacy version of the extension method. Please use the new one using SinkOptions instead.
174+
/// Note: this is the legacy version of the extension method. Please use the new one using MSSqlServerSinkOptions instead.
176175
///
177176
/// </summary>
178177
/// <param name="loggerAuditSinkConfiguration">The logger configuration.</param>
@@ -188,7 +187,7 @@ internal static LoggerConfiguration MSSqlServerInternal(
188187
/// <param name="logEventFormatter">Supplies custom formatter for the LogEvent column, or null</param>
189188
/// <returns>Logger configuration, allowing configuration to continue.</returns>
190189
/// <exception cref="ArgumentNullException">A required parameter is null.</exception>
191-
[Obsolete("Use the new interface accepting a SinkOptions parameter instead. This will be removed in a future release.", error: false)]
190+
[Obsolete("Use the new interface accepting a MSSqlServerSinkOptions parameter instead. This will be removed in a future release.", error: false)]
192191
public static LoggerConfiguration MSSqlServer(
193192
this LoggerAuditSinkConfiguration loggerAuditSinkConfiguration,
194193
string connectionString,
@@ -203,9 +202,9 @@ public static LoggerConfiguration MSSqlServer(
203202
ITextFormatter logEventFormatter = null)
204203
{
205204
// Do not add new parameters here. This interface is considered legacy and will be deprecated in the future.
206-
// For adding new input parameters use the SinkOptions class and the method overload that accepts SinkOptions.
205+
// For adding new input parameters use the MSSqlServerSinkOptions class and the method overload that accepts MSSqlServerSinkOptions.
207206

208-
var sinkOptions = new SinkOptions(tableName, null, null, autoCreateSqlTable, schemaName);
207+
var sinkOptions = new MSSqlServerSinkOptions(tableName, null, null, autoCreateSqlTable, schemaName);
209208

210209
return loggerAuditSinkConfiguration.MSSqlServer(
211210
connectionString: connectionString,
@@ -237,7 +236,7 @@ public static LoggerConfiguration MSSqlServer(
237236
public static LoggerConfiguration MSSqlServer(
238237
this LoggerAuditSinkConfiguration loggerAuditSinkConfiguration,
239238
string connectionString,
240-
SinkOptions sinkOptions = null,
239+
MSSqlServerSinkOptions sinkOptions = null,
241240
IConfigurationSection sinkOptionsSection = null,
242241
IConfiguration appConfiguration = null,
243242
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
@@ -263,7 +262,7 @@ public static LoggerConfiguration MSSqlServer(
263262
internal static LoggerConfiguration MSSqlServerInternal(
264263
this LoggerAuditSinkConfiguration loggerAuditSinkConfiguration,
265264
string connectionString,
266-
SinkOptions sinkOptions,
265+
MSSqlServerSinkOptions sinkOptions,
267266
IConfigurationSection sinkOptionsSection,
268267
IConfiguration appConfiguration,
269268
LogEventLevel restrictedToMinimumLevel,
@@ -288,15 +287,15 @@ internal static LoggerConfiguration MSSqlServerInternal(
288287

289288
private static void ReadConfiguration(
290289
ref string connectionString,
291-
ref SinkOptions sinkOptions,
290+
ref MSSqlServerSinkOptions sinkOptions,
292291
IConfigurationSection sinkOptionsSection,
293292
IConfiguration appConfiguration,
294293
ref ColumnOptions columnOptions,
295294
IConfigurationSection columnOptionsSection,
296295
IApplySystemConfiguration applySystemConfiguration,
297296
IApplyMicrosoftExtensionsConfiguration applyMicrosoftExtensionsConfiguration)
298297
{
299-
sinkOptions = sinkOptions ?? new SinkOptions();
298+
sinkOptions = sinkOptions ?? new MSSqlServerSinkOptions();
300299
columnOptions = columnOptions ?? new ColumnOptions();
301300

302301
var serviceConfigSection = applySystemConfiguration.GetSinkConfigurationSection(AppConfigSectionName);

src/Serilog.Sinks.MSSqlServer/Configuration/Extensions/Microsoft.Extensions.Configuration/LoggerConfigurationMSSqlServerExtensions.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using Serilog.Formatting;
2020
using Serilog.Sinks.MSSqlServer;
2121
using Serilog.Sinks.MSSqlServer.Configuration.Factories;
22-
using Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options;
2322

2423
// M.E.C. support for .NET Standard 2.0 libraries.
2524

@@ -36,7 +35,7 @@ public static partial class LoggerConfigurationMSSqlServerExtensions
3635
/// https://gist.github.com/mivano/10429656
3736
/// or use the autoCreateSqlTable option.
3837
///
39-
/// Note: this is the legacy version of the extension method. Please use the new one using SinkOptions instead.
38+
/// Note: this is the legacy version of the extension method. Please use the new one using MSSqlServerSinkOptions instead.
4039
///
4140
/// </summary>
4241
/// <param name="loggerConfiguration">The logger configuration.</param>
@@ -54,7 +53,7 @@ public static partial class LoggerConfigurationMSSqlServerExtensions
5453
/// <param name="logEventFormatter">Supplies custom formatter for the LogEvent column, or null</param>
5554
/// <returns>Logger configuration, allowing configuration to continue.</returns>
5655
/// <exception cref="ArgumentNullException">A required parameter is null.</exception>
57-
[Obsolete("Use the new interface accepting a SinkOptions parameter instead. This will be removed in a future release.", error: false)]
56+
[Obsolete("Use the new interface accepting a MSSqlServerSinkOptions parameter instead. This will be removed in a future release.", error: false)]
5857
public static LoggerConfiguration MSSqlServer(
5958
this LoggerSinkConfiguration loggerConfiguration,
6059
string connectionString,
@@ -71,9 +70,9 @@ public static LoggerConfiguration MSSqlServer(
7170
ITextFormatter logEventFormatter = null)
7271
{
7372
// Do not add new parameters here. This interface is considered legacy and will be deprecated in the future.
74-
// For adding new input parameters use the SinkOptions class and the method overload that accepts SinkOptions.
73+
// For adding new input parameters use the MSSqlServerSinkOptions class and the method overload that accepts MSSqlServerSinkOptions.
7574

76-
var sinkOptions = new SinkOptions(tableName, batchPostingLimit, period, autoCreateSqlTable, schemaName);
75+
var sinkOptions = new MSSqlServerSinkOptions(tableName, batchPostingLimit, period, autoCreateSqlTable, schemaName);
7776

7877
return loggerConfiguration.MSSqlServer(
7978
connectionString: connectionString,
@@ -108,7 +107,7 @@ public static LoggerConfiguration MSSqlServer(
108107
public static LoggerConfiguration MSSqlServer(
109108
this LoggerSinkConfiguration loggerConfiguration,
110109
string connectionString,
111-
SinkOptions sinkOptions = null,
110+
MSSqlServerSinkOptions sinkOptions = null,
112111
IConfigurationSection sinkOptionsSection = null,
113112
IConfiguration appConfiguration = null,
114113
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
@@ -135,7 +134,7 @@ public static LoggerConfiguration MSSqlServer(
135134
/// <summary>
136135
/// Adds a sink that writes log events to a table in a MSSqlServer database.
137136
///
138-
/// Note: this is the legacy version of the extension method. Please use the new one using SinkOptions instead.
137+
/// Note: this is the legacy version of the extension method. Please use the new one using MSSqlServerSinkOptions instead.
139138
///
140139
/// </summary>
141140
/// <param name="loggerAuditSinkConfiguration">The logger configuration.</param>
@@ -151,7 +150,7 @@ public static LoggerConfiguration MSSqlServer(
151150
/// <param name="logEventFormatter">Supplies custom formatter for the LogEvent column, or null</param>
152151
/// <returns>Logger configuration, allowing configuration to continue.</returns>
153152
/// <exception cref="ArgumentNullException">A required parameter is null.</exception>
154-
[Obsolete("Use the new interface accepting a SinkOptions parameter instead. This will be removed in a future release.", error: false)]
153+
[Obsolete("Use the new interface accepting a MSSqlServerSinkOptions parameter instead. This will be removed in a future release.", error: false)]
155154
public static LoggerConfiguration MSSqlServer(
156155
this LoggerAuditSinkConfiguration loggerAuditSinkConfiguration,
157156
string connectionString,
@@ -166,9 +165,9 @@ public static LoggerConfiguration MSSqlServer(
166165
ITextFormatter logEventFormatter = null)
167166
{
168167
// Do not add new parameters here. This interface is considered legacy and will be deprecated in the future.
169-
// For adding new input parameters use the SinkOptions class and the method overload that accepts SinkOptions.
168+
// For adding new input parameters use the MSSqlServerSinkOptions class and the method overload that accepts MSSqlServerSinkOptions.
170169

171-
var sinkOptions = new SinkOptions(tableName, null, null, autoCreateSqlTable, schemaName);
170+
var sinkOptions = new MSSqlServerSinkOptions(tableName, null, null, autoCreateSqlTable, schemaName);
172171

173172
return loggerAuditSinkConfiguration.MSSqlServer(
174173
connectionString: connectionString,
@@ -200,7 +199,7 @@ public static LoggerConfiguration MSSqlServer(
200199
public static LoggerConfiguration MSSqlServer(
201200
this LoggerAuditSinkConfiguration loggerAuditSinkConfiguration,
202201
string connectionString,
203-
SinkOptions sinkOptions = null,
202+
MSSqlServerSinkOptions sinkOptions = null,
204203
IConfigurationSection sinkOptionsSection = null,
205204
IConfiguration appConfiguration = null,
206205
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
@@ -223,13 +222,13 @@ public static LoggerConfiguration MSSqlServer(
223222

224223
private static void ReadConfiguration(
225224
ref string connectionString,
226-
ref SinkOptions sinkOptions,
225+
ref MSSqlServerSinkOptions sinkOptions,
227226
IConfiguration appConfiguration,
228227
ref ColumnOptions columnOptions,
229228
IConfigurationSection columnOptionsSection,
230229
IConfigurationSection sinkOptionsSection)
231230
{
232-
sinkOptions = sinkOptions ?? new SinkOptions();
231+
sinkOptions = sinkOptions ?? new MSSqlServerSinkOptions();
233232
columnOptions = columnOptions ?? new ColumnOptions();
234233

235234
IApplyMicrosoftExtensionsConfiguration microsoftExtensionsConfiguration = new ApplyMicrosoftExtensionsConfiguration();

0 commit comments

Comments
 (0)