@@ -44,11 +44,8 @@ private EnabledNullLogger() { }
4444 public static readonly ILogger Instance = new EnabledNullLogger ( ) ;
4545
4646 public bool IsEnabled ( LogLevel level ) => true ; // NullLogger now says "no", which breaks our counting
47- #if NET10_0_OR_GREATER
47+
4848 public IDisposable ? BeginScope < TState > ( TState state ) where TState : notnull => this ;
49- #else
50- public IDisposable BeginScope < TState > ( TState state ) => this ;
51- #endif
5249
5350 public void Log < TState > (
5451 LogLevel logLevel ,
@@ -87,11 +84,8 @@ public class TestWrapperLogger(ILogger toWrap) : ILogger
8784 public int LogCount = 0 ;
8885 private ILogger Inner { get ; } = toWrap ;
8986
90- #if NET8_0_OR_GREATER
9187 public IDisposable ? BeginScope < TState > ( TState state ) where TState : notnull => Inner . BeginScope ( state ) ;
92- #else
93- public IDisposable BeginScope < TState > ( TState state ) => Inner . BeginScope ( state ) ;
94- #endif
88+
9589 public bool IsEnabled ( LogLevel logLevel ) => Inner . IsEnabled ( logLevel ) ;
9690 public void Log < TState > ( LogLevel logLevel , EventId eventId , TState state , Exception ? exception , Func < TState , Exception ? , string > formatter )
9791 {
@@ -105,11 +99,8 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
10599 /// </summary>
106100 private sealed class TestMultiLogger ( params ILogger [ ] loggers ) : ILogger
107101 {
108- #if NET8_0_OR_GREATER
109102 public IDisposable ? BeginScope < TState > ( TState state ) where TState : notnull => null ;
110- #else
111- public IDisposable BeginScope < TState > ( TState state ) => null ! ;
112- #endif
103+
113104 public bool IsEnabled ( LogLevel logLevel ) => true ;
114105 public void Log < TState > ( LogLevel logLevel , EventId eventId , TState state , Exception ? exception , Func < TState , Exception ? , string > formatter )
115106 {
@@ -129,11 +120,8 @@ private sealed class TestLogger : ILogger
129120 public TestLogger ( LogLevel logLevel , TextWriter output ) =>
130121 ( _logLevel , _output ) = ( logLevel , output ) ;
131122
132- #if NET8_0_OR_GREATER
133123 public IDisposable ? BeginScope < TState > ( TState state ) where TState : notnull => null ;
134- #else
135- public IDisposable BeginScope < TState > ( TState state ) => null ! ;
136- #endif
124+
137125 public bool IsEnabled ( LogLevel logLevel ) => logLevel >= _logLevel ;
138126 public void Log < TState > ( LogLevel logLevel , EventId eventId , TState state , Exception ? exception , Func < TState , Exception ? , string > formatter )
139127 {
0 commit comments