diff --git a/src/Servers/HttpSys/src/RequestProcessing/RequestContextLog.cs b/src/Servers/HttpSys/src/RequestProcessing/RequestContextLog.cs new file mode 100644 index 000000000000..c1eff6ad8df8 --- /dev/null +++ b/src/Servers/HttpSys/src/RequestProcessing/RequestContextLog.cs @@ -0,0 +1,35 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.Extensions.Logging; + +namespace Microsoft.AspNetCore.Server.HttpSys +{ + internal static class RequestContextLog + { + private static readonly Action _requestError = + LoggerMessage.Define(LogLevel.Error, LoggerEventIds.RequestError, "ProcessRequestAsync"); + + private static readonly Action _requestProcessError = + LoggerMessage.Define(LogLevel.Error, LoggerEventIds.RequestProcessError, "ProcessRequestAsync"); + + private static readonly Action _requestsDrained = + LoggerMessage.Define(LogLevel.Information, LoggerEventIds.RequestsDrained, "All requests drained."); + + public static void RequestError(ILogger logger, Exception exception) + { + _requestError(logger, exception); + } + + public static void RequestProcessError(ILogger logger, Exception exception) + { + _requestProcessError(logger, exception); + } + + public static void RequestsDrained(ILogger logger) + { + _requestsDrained(logger, null); + } + } +} diff --git a/src/Servers/HttpSys/src/RequestProcessing/RequestContextOfT.Log.cs b/src/Servers/HttpSys/src/RequestProcessing/RequestContextOfT.Log.cs deleted file mode 100644 index f387bf179db4..000000000000 --- a/src/Servers/HttpSys/src/RequestProcessing/RequestContextOfT.Log.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.Extensions.Logging; - -namespace Microsoft.AspNetCore.Server.HttpSys -{ - internal sealed partial class RequestContext - { - private static class Log - { - private static readonly Action _requestError = - LoggerMessage.Define(LogLevel.Error, LoggerEventIds.RequestError, "ProcessRequestAsync"); - - private static readonly Action _requestProcessError = - LoggerMessage.Define(LogLevel.Error, LoggerEventIds.RequestProcessError, "ProcessRequestAsync"); - - private static readonly Action _requestsDrained = - LoggerMessage.Define(LogLevel.Information, LoggerEventIds.RequestsDrained, "All requests drained."); - - public static void RequestError(ILogger logger, Exception exception) - { - _requestError(logger, exception); - } - - public static void RequestProcessError(ILogger logger, Exception exception) - { - _requestProcessError(logger, exception); - } - - public static void RequestsDrained(ILogger logger) - { - _requestsDrained(logger, null); - } - } - } -} diff --git a/src/Servers/HttpSys/src/RequestProcessing/RequestContextOfT.cs b/src/Servers/HttpSys/src/RequestProcessing/RequestContextOfT.cs index 1d7eb0412e02..88947e041f8c 100644 --- a/src/Servers/HttpSys/src/RequestProcessing/RequestContextOfT.cs +++ b/src/Servers/HttpSys/src/RequestProcessing/RequestContextOfT.cs @@ -51,7 +51,7 @@ protected override async Task ExecuteAsync() } catch (Exception ex) { - Log.RequestProcessError(Logger, ex); + RequestContextLog.RequestProcessError(Logger, ex); if (context != null) { application.DisposeContext(context, ex); @@ -85,14 +85,14 @@ protected override async Task ExecuteAsync() { if (messagePump.DecrementOutstandingRequest() == 0 && messagePump.Stopping) { - Log.RequestsDrained(Logger); + RequestContextLog.RequestsDrained(Logger); messagePump.SetShutdownSignal(); } } } catch (Exception ex) { - Log.RequestError(Logger, ex); + RequestContextLog.RequestError(Logger, ex); Abort(); } }