@@ -47,12 +47,37 @@ public static LoggerConfiguration WithTruncateSourceContextEnricher(this LoggerC
4747 // -----------------------------------------------------------------------------------------------------------------
4848 // Opinionated configurations
4949 // -----------------------------------------------------------------------------------------------------------------
50- public static LoggerConfiguration AsAnnaSasDevServerConsole ( this LoggerConfiguration loggerConfiguration , int sectionMaxLength = 12 ) =>
51- loggerConfiguration
50+ public static LoggerConfiguration AsAnnaSasDevServerConsole (
51+ this LoggerConfiguration loggerConfiguration ,
52+ int sectionMaxLength = 12 ,
53+ Action < AsyncConsoleConfig > ? configure = null
54+ ) {
55+ var asyncConsoleConfig = new AsyncConsoleConfig ( ) ;
56+ configure ? . Invoke ( asyncConsoleConfig ) ;
57+
58+ return loggerConfiguration
5259 . Enrich . FromLogContext ( )
5360 . WithPaddedSectionEnricher ( maxLength : sectionMaxLength )
5461 . WriteToAsyncConsole (
55- outputTemplate : ConsoleOutputTemplates . AnnaSasDevServer ,
56- theme : ConsoleThemes . AnnaSasDevTheme
62+ restrictedToMinimumLevel : asyncConsoleConfig . RestrictedToMinimumLevel ,
63+ outputTemplate : asyncConsoleConfig . OutputTemplate ,
64+ formatProvider : asyncConsoleConfig . FormatProvider ,
65+ levelSwitch : asyncConsoleConfig . LevelSwitch ,
66+ standardErrorFromLevel : asyncConsoleConfig . StandardErrorFromLevel ,
67+ theme : asyncConsoleConfig . Theme ,
68+ applyThemeToRedirectedOutput : asyncConsoleConfig . ApplyThemeToRedirectedOutput ,
69+ syncRoot : asyncConsoleConfig . SyncRoot
5770 ) ;
71+ }
72+
73+ public class AsyncConsoleConfig {
74+ public LogEventLevel RestrictedToMinimumLevel { get ; set ; } = LogEventLevel . Verbose ;
75+ public string OutputTemplate { get ; set ; } = ConsoleOutputTemplates . AnnaSasDevServer ;
76+ public IFormatProvider ? FormatProvider { get ; set ; } = null ;
77+ public LoggingLevelSwitch ? LevelSwitch { get ; set ; } = null ;
78+ public LogEventLevel ? StandardErrorFromLevel { get ; set ; } = null ;
79+ public ConsoleTheme ? Theme { get ; set ; } = ConsoleThemes . AnnaSasDevTheme ;
80+ public bool ApplyThemeToRedirectedOutput { get ; set ; } = false ;
81+ public object ? SyncRoot { get ; set ; } = null ;
82+ }
5883}
0 commit comments