Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit 7b71eca

Browse files
committed
Return null scope if no loggers
1 parent bd778d4 commit 7b71eca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Microsoft.Framework.Logging/Logger.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ public bool IsEnabled(LogLevel logLevel)
9797
public IDisposable BeginScopeImpl(object state)
9898
{
9999
var loggers = _loggers;
100+
if (loggers.Length == 0)
101+
{
102+
return null;
103+
}
100104
var scope = new Scope(loggers.Length);
101105
List<Exception> exceptions = null;
102106
for (var index = 0; index != loggers.Length; index++)
@@ -198,4 +202,4 @@ internal void Add(IDisposable disposable)
198202
}
199203
}
200204
}
201-
}
205+
}

0 commit comments

Comments
 (0)