Merge pull request #375 from benaadams/log-scope-only-enabled

Proposal: Start log scope only if logging is enabled
This commit is contained in:
David Fowler 2015-09-30 03:09:31 -07:00
commit e323a14b43
1 changed files with 3 additions and 1 deletions

View File

@ -105,7 +105,9 @@ namespace Microsoft.AspNet.Hosting.Internal
try
{
using (logger.BeginScope("Request Id: {RequestId}", requestIdentifier))
using (logger.IsEnabled(LogLevel.Critical)
? logger.BeginScope("Request Id: {RequestId}", requestIdentifier)
: null)
{
await application(httpContext);
}