From 9e188c5c1a5efb49c37b1b28a5fe8d8d4bad71d6 Mon Sep 17 00:00:00 2001 From: Rafael Cordeiro Date: Fri, 17 Jul 2020 21:40:11 -0700 Subject: [PATCH 1/2] Add more XML Documentation --- .../ConsoleLoggerConfigurationExtensions.cs | 4 ++++ .../Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs | 4 ++-- .../Sinks/SystemConsole/Themes/SystemConsoleTheme.cs | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs b/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs index fa6a352..6d4fa74 100644 --- a/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs +++ b/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs @@ -50,6 +50,8 @@ public static class ConsoleLoggerConfigurationExtensions /// uses . /// Applies the selected or default theme even when output redirection is detected. /// Configuration object allowing method chaining. + /// When is null + /// When is null public static LoggerConfiguration Console( this LoggerSinkConfiguration sinkConfiguration, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum, @@ -89,6 +91,8 @@ public static class ConsoleLoggerConfigurationExtensions /// to be changed at runtime. /// Specifies the level at which events will be written to standard error. /// Configuration object allowing method chaining. + /// When is null + /// When is null public static LoggerConfiguration Console( this LoggerSinkConfiguration sinkConfiguration, ITextFormatter formatter, diff --git a/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs b/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs index 3ff6ce8..5809b65 100644 --- a/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs +++ b/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs @@ -47,10 +47,10 @@ public class AnsiConsoleTheme : ConsoleTheme /// Construct a theme given a set of styles. /// /// Styles to apply within the theme. + /// When is null public AnsiConsoleTheme(IReadOnlyDictionary styles) { - if (styles == null) throw new ArgumentNullException(nameof(styles)); - _styles = styles.ToDictionary(kv => kv.Key, kv => kv.Value); + _styles = styles?.ToDictionary(kv => kv.Key, kv => kv.Value) ?? throw new ArgumentNullException(nameof(styles)); } /// diff --git a/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/SystemConsoleTheme.cs b/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/SystemConsoleTheme.cs index 5eaf7d8..ce78587 100644 --- a/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/SystemConsoleTheme.cs +++ b/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/SystemConsoleTheme.cs @@ -44,10 +44,10 @@ public class SystemConsoleTheme : ConsoleTheme /// Construct a theme given a set of styles. /// /// Styles to apply within the theme. + /// When is null public SystemConsoleTheme(IReadOnlyDictionary styles) { - if (styles == null) throw new ArgumentNullException(nameof(styles)); - Styles = styles.ToDictionary(kv => kv.Key, kv => kv.Value); + Styles = styles?.ToDictionary(kv => kv.Key, kv => kv.Value) ?? throw new ArgumentNullException(nameof(styles)); } /// From 65ce4a1d7a583e6847006df3664454afd79cf17f Mon Sep 17 00:00:00 2001 From: Rafael Cordeiro Date: Wed, 22 Jul 2020 23:33:50 -0700 Subject: [PATCH 2/2] Rollback Refactor --- .../Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs | 3 ++- .../Sinks/SystemConsole/Themes/SystemConsoleTheme.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs b/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs index 5809b65..3b80f53 100644 --- a/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs +++ b/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleTheme.cs @@ -50,7 +50,8 @@ public class AnsiConsoleTheme : ConsoleTheme /// When is null public AnsiConsoleTheme(IReadOnlyDictionary styles) { - _styles = styles?.ToDictionary(kv => kv.Key, kv => kv.Value) ?? throw new ArgumentNullException(nameof(styles)); + if (styles == null) throw new ArgumentNullException(nameof(styles)); + _styles = styles.ToDictionary(kv => kv.Key, kv => kv.Value); } /// diff --git a/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/SystemConsoleTheme.cs b/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/SystemConsoleTheme.cs index ce78587..9618f18 100644 --- a/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/SystemConsoleTheme.cs +++ b/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/SystemConsoleTheme.cs @@ -47,7 +47,8 @@ public class SystemConsoleTheme : ConsoleTheme /// When is null public SystemConsoleTheme(IReadOnlyDictionary styles) { - Styles = styles?.ToDictionary(kv => kv.Key, kv => kv.Value) ?? throw new ArgumentNullException(nameof(styles)); + if (styles == null) throw new ArgumentNullException(nameof(styles)); + Styles = styles.ToDictionary(kv => kv.Key, kv => kv.Value); } ///