66using SharpCoreDB . Interfaces ;
77using SharpCoreDB . Services ;
88using Microsoft . Extensions . DependencyInjection ;
9+
910namespace SharpCoreDB . Serilog . Sinks ;
10- /// Michel Posseth
11+
12+ /// Michel Posseth
1113/// <summary>
1214/// Extension methods for configuring the SharpCoreDB sink with Serilog.
15+ /// Provides three overloads: database instance, connection string, and options object.
1316/// </summary>
1417public static class LoggerConfigurationExtensions
1518{
@@ -39,7 +42,6 @@ public static LoggerConfiguration SharpCoreDB(
3942 string storageEngine = "AppendOnly" )
4043 {
4144 ArgumentNullException . ThrowIfNull ( loggerSinkConfiguration ) ;
42-
4345 ArgumentNullException . ThrowIfNull ( database ) ;
4446
4547 var actualPeriod = period ?? DefaultPeriod ;
@@ -65,6 +67,7 @@ public static LoggerConfiguration SharpCoreDB(
6567
6668 /// <summary>
6769 /// Writes log events to a SharpCoreDB database using a connection string.
70+ /// Creates a database instance internally with logging-optimized configuration.
6871 /// </summary>
6972 /// <param name="loggerSinkConfiguration">The logger sink configuration.</param>
7073 /// <param name="path">The path to the .scdb file.</param>
@@ -90,22 +93,14 @@ public static LoggerConfiguration SharpCoreDB(
9093 IServiceProvider ? serviceProvider = null )
9194 {
9295 ArgumentNullException . ThrowIfNull ( loggerSinkConfiguration ) ;
93-
94- if ( string . IsNullOrWhiteSpace ( path ) )
95- {
96- throw new ArgumentException ( "Path cannot be null or whitespace." , nameof ( path ) ) ;
97- }
98-
99- if ( string . IsNullOrWhiteSpace ( password ) )
100- {
101- throw new ArgumentException ( "Password cannot be null or whitespace." , nameof ( password ) ) ;
102- }
96+ ArgumentException . ThrowIfNullOrWhiteSpace ( path ) ;
97+ ArgumentException . ThrowIfNullOrWhiteSpace ( password ) ;
10398
10499 // Create or use provided service provider
105100 var services = serviceProvider ?? CreateDefaultServiceProvider ( ) ;
106101 var factory = services . GetRequiredService < DatabaseFactory > ( ) ;
107-
108- // Create database with optimized config for logging
102+
103+ // Create database with config optimized for logging workloads
109104 var config = new DatabaseConfig
110105 {
111106 EnableQueryCache = false , // Logs are typically write-once
@@ -131,7 +126,7 @@ public static LoggerConfiguration SharpCoreDB(
131126 }
132127
133128 /// <summary>
134- /// Writes log events to a SharpCoreDB database using options.
129+ /// Writes log events to a SharpCoreDB database using an options object .
135130 /// </summary>
136131 /// <param name="loggerSinkConfiguration">The logger sink configuration.</param>
137132 /// <param name="options">The sink options.</param>
@@ -141,10 +136,9 @@ public static LoggerConfiguration SharpCoreDB(
141136 SharpCoreDBSinkOptions options )
142137 {
143138 ArgumentNullException . ThrowIfNull ( loggerSinkConfiguration ) ;
144-
145139 ArgumentNullException . ThrowIfNull ( options ) ;
146140
147- if ( options . Database != null )
141+ if ( options . Database is not null )
148142 {
149143 return SharpCoreDB (
150144 loggerSinkConfiguration ,
0 commit comments