diff --git a/libraries/Microsoft.Bot.Connector.Streaming/Application/StreamingTransportClient.cs b/libraries/Microsoft.Bot.Connector.Streaming/Application/StreamingTransportClient.cs index 046f8e5365..16097d1a7a 100644 --- a/libraries/Microsoft.Bot.Connector.Streaming/Application/StreamingTransportClient.cs +++ b/libraries/Microsoft.Bot.Connector.Streaming/Application/StreamingTransportClient.cs @@ -304,16 +304,16 @@ private static class Log LogLevel.Information, new EventId(1, nameof(ClientStarted)), "Streaming transport client connected to {string}."); private static readonly Action _clientCompleted = LoggerMessage.Define( - LogLevel.Information, new EventId(2, nameof(ClientKeepAliveSucceed)), "Streaming transport client connection to {string} closed."); + LogLevel.Information, new EventId(2, nameof(ClientCompleted)), "Streaming transport client connection to {string} closed."); private static readonly Action _clientKeepAliveSucceed = LoggerMessage.Define( - LogLevel.Debug, new EventId(3, nameof(ClientStarted)), "Streaming transport client heartbeat to {string} succeeded."); + LogLevel.Debug, new EventId(3, nameof(ClientKeepAliveSucceed)), "Streaming transport client heartbeat to {string} succeeded."); private static readonly Action _clientKeepAliveFail = LoggerMessage.Define( LogLevel.Error, new EventId(4, nameof(ClientKeepAliveFail)), "Streaming transport client heartbeat to {string} failed with status code {int}."); private static readonly Action _clientTransportApplicationCompleted = LoggerMessage.Define( - LogLevel.Debug, new EventId(5, nameof(ClientTransportApplicationCompleted)), "Streaming transport client heartbeat to {string} completed transport and application tasks."); + LogLevel.Debug, new EventId(5, nameof(ClientTransportApplicationCompleted)), "Streaming transport client to {string} completed transport and application tasks."); public static void ClientStarted(ILogger logger, string url) => _clientStarted(logger, url ?? string.Empty, null); diff --git a/libraries/Microsoft.Bot.Connector.Streaming/Session/StreamingSession.cs b/libraries/Microsoft.Bot.Connector.Streaming/Session/StreamingSession.cs index e5aafc74d1..6d0027e414 100644 --- a/libraries/Microsoft.Bot.Connector.Streaming/Session/StreamingSession.cs +++ b/libraries/Microsoft.Bot.Connector.Streaming/Session/StreamingSession.cs @@ -504,10 +504,10 @@ internal class StreamDefinition : IContentStream private class Log { private static readonly Action _orphanedStream = - LoggerMessage.Define(LogLevel.Error, new EventId(1, nameof(OrphanedStream)), "Stream has no associated payload. Header: ID {Guid} Type {char} Payload length:{int}. End :{bool}."); + LoggerMessage.Define(LogLevel.Error, new EventId(1, nameof(OrphanedStream)), "Stream has no associated payload. Header: ID {Guid} Type: {char} Payload length: {int} End: {bool}"); private static readonly Action _payloadReceived = - LoggerMessage.Define(LogLevel.Debug, new EventId(2, nameof(PayloadReceived)), "Payload received in session. Header: ID {Guid} Type {char} Payload length:{int}. End :{bool}.."); + LoggerMessage.Define(LogLevel.Debug, new EventId(2, nameof(PayloadReceived)), "Payload received in session. Header: ID {Guid} Type: {char} Payload length: {int} End: {bool}"); public static void OrphanedStream(ILogger logger, Header header) => _orphanedStream(logger, header.Id, header.Type, header.PayloadLength, header.End, null); diff --git a/libraries/Microsoft.Bot.Connector.Streaming/Transport/TransportHandler.cs b/libraries/Microsoft.Bot.Connector.Streaming/Transport/TransportHandler.cs index 519a4de01f..0d37d64fa7 100644 --- a/libraries/Microsoft.Bot.Connector.Streaming/Transport/TransportHandler.cs +++ b/libraries/Microsoft.Bot.Connector.Streaming/Transport/TransportHandler.cs @@ -341,16 +341,16 @@ private async Task WriteAsync(Header header, Func writeFunc, C private static class Log { private static readonly Action _payloadReceived = - LoggerMessage.Define(LogLevel.Debug, new EventId(1, nameof(PayloadReceived)), "Payload received. Header: ID {Guid} Type {char} Payload length:{int}. End :{bool}."); + LoggerMessage.Define(LogLevel.Debug, new EventId(1, nameof(PayloadReceived)), "Payload received. Header: ID {Guid} Type: {char} Payload length: {int} End: {bool}"); private static readonly Action _readFrameFailed = LoggerMessage.Define(LogLevel.Error, new EventId(2, nameof(ReadFrameFailed)), "Failed to read frame from transport."); private static readonly Action _payloadSending = - LoggerMessage.Define(LogLevel.Debug, new EventId(3, nameof(SendingPayload)), "Sending Payload. Header: ID {Guid} Type {char} Payload length:{int}. End :{bool}."); + LoggerMessage.Define(LogLevel.Debug, new EventId(3, nameof(SendingPayload)), "Sending Payload. Header: ID {Guid} Type: {char} Payload length: {int} End: {bool}"); private static readonly Action _semaphoreTimeOut = - LoggerMessage.Define(LogLevel.Error, new EventId(4, nameof(SemaphoreTimeOut)), "Timed out trying to acquire write semaphore. Header: ID {Guid} Type {char} Payload length:{int}. End :{bool}."); + LoggerMessage.Define(LogLevel.Error, new EventId(4, nameof(SemaphoreTimeOut)), "Timed out trying to acquire write semaphore. Header: ID {Guid} Type: {char} Payload length: {int} End: {bool}"); private static readonly Action _listenError = LoggerMessage.Define(LogLevel.Error, new EventId(5, nameof(ListenError)), "TransportHandler encountered an error and will stop listening."); diff --git a/libraries/integration/Microsoft.Bot.Builder.Integration.AspNet.Core/CloudAdapter.cs b/libraries/integration/Microsoft.Bot.Builder.Integration.AspNet.Core/CloudAdapter.cs index 65bb2853e5..4d1acaf9d6 100644 --- a/libraries/integration/Microsoft.Bot.Builder.Integration.AspNet.Core/CloudAdapter.cs +++ b/libraries/integration/Microsoft.Bot.Builder.Integration.AspNet.Core/CloudAdapter.cs @@ -166,10 +166,10 @@ public async Task ConnectNamedPipeAsync(string pipeName, IBot bot, string appId, { // Start receiving activities on the named pipe _streamingConnections.TryAdd(connectionId, streamingActivityProcessor); - Log.WebSocketConnectionStarted(Logger); + Log.NamedPipeConnectionStarted(Logger); await streamingActivityProcessor.ListenAsync(CancellationToken.None).ConfigureAwait(false); _streamingConnections.TryRemove(connectionId, out _); - Log.WebSocketConnectionCompleted(Logger); + Log.NamedPipeConnectionCompleted(Logger); Logger.LogWarning("Named pipe got disconnected. Reconnecting."); } } @@ -365,12 +365,22 @@ private async Task CreateHttpResponseAsync(ReceiveResponse private class Log { + private static readonly Action _namedPipeConnectionStarted = + LoggerMessage.Define(LogLevel.Information, new EventId(1, nameof(NamedPipeConnectionStarted)), "NamedPipe connection started."); + + private static readonly Action _namedConnectionCompleted = + LoggerMessage.Define(LogLevel.Information, new EventId(2, nameof(NamedPipeConnectionCompleted)), "NamedPipe connection completed."); + private static readonly Action _webSocketConnectionStarted = LoggerMessage.Define(LogLevel.Information, new EventId(1, nameof(WebSocketConnectionStarted)), "WebSocket connection started."); private static readonly Action _webSocketConnectionCompleted = LoggerMessage.Define(LogLevel.Information, new EventId(2, nameof(WebSocketConnectionCompleted)), "WebSocket connection completed."); + public static void NamedPipeConnectionStarted(ILogger logger) => _namedPipeConnectionStarted(logger, null); + + public static void NamedPipeConnectionCompleted(ILogger logger) => _namedConnectionCompleted(logger, null); + public static void WebSocketConnectionStarted(ILogger logger) => _webSocketConnectionStarted(logger, null); public static void WebSocketConnectionCompleted(ILogger logger) => _webSocketConnectionCompleted(logger, null);