Skip to content

Commit

Permalink
Lower EndpointOffline to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
vicancy committed Nov 26, 2024
1 parent a7f0d8c commit bf92d1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ private static class Log
LoggerMessage.Define<string, string>(LogLevel.Information, new EventId(1, "EndpointOnline"), "Hub '{hub}' is now connected to '{endpoint}'.");

private static readonly Action<ILogger, string, string, Exception> _endpointOffline =
LoggerMessage.Define<string, string>(LogLevel.Error, new EventId(2, "EndpointOffline"), "Hub '{hub}' is now disconnected from '{endpoint}'. Please check log for detailed info.");
LoggerMessage.Define<string, string>(LogLevel.Warning, new EventId(2, "EndpointOffline"), "Hub '{hub}' is now disconnected from '{endpoint}'. Please check log for detailed info.");

private static readonly Action<ILogger, Exception> _receivedFinAckPing =
LoggerMessage.Define(LogLevel.Information, new EventId(3, "ReceivedFinAckPing"), "Received FinAck ping.");
Expand Down
7 changes: 4 additions & 3 deletions test/Microsoft.Azure.SignalR.Tests/RunSignalRTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task TestRunSignalRWithSimpleHub()
Assert.NotNull(connectionDisconnectLog);
Assert.Equal("conn1 disconnected: .", connectionDisconnectLog.Write.Message);

Assert.Empty(logs.Where(s => s.Write.LogLevel == LogLevel.Warning));
Assert.Empty(logs.Where(s => s.Write.LogLevel == LogLevel.Warning && s.Write.EventId.Name != "EndpointOffline").Select(s => s.Write.EventId.Name));
}

[Fact]
Expand Down Expand Up @@ -108,7 +108,8 @@ public async Task TestRunSignalRWithSimpleHubAndMultipleConnections()
Assert.Equal(0, logs.Count(s => s.Write.EventId.Name == "DetectedLongRunningApplicationTask"));

Assert.Equal(count, logs.Count(s => s.Write.LoggerName == typeof(SimpleHub).FullName));
Assert.Empty(logs.Where(s => s.Write.LogLevel == LogLevel.Warning));

Assert.Empty(logs.Where(s => s.Write.LogLevel == LogLevel.Warning && s.Write.EventId.Name != "EndpointOffline").Select(s => s.Write.EventId.Name));
}

[Fact]
Expand Down Expand Up @@ -146,7 +147,7 @@ public async Task TestRunSignalRWithConnectedSendingMessages()
var connectionDisconnectLog = logs.FirstOrDefault(s => s.Write.LoggerName == typeof(ConnectedHub).FullName);
Assert.NotNull(connectionDisconnectLog);
Assert.Equal("conn1 disconnected: .", connectionDisconnectLog.Write.Message);
Assert.Empty(logs.Where(s => s.Write.LogLevel == LogLevel.Warning && s.Write.EventId.Name != "DetectedLongRunningApplicationTask").Select(s => s.Write.EventId.Name));
Assert.Empty(logs.Where(s => s.Write.LogLevel == LogLevel.Warning && s.Write.EventId.Name != "DetectedLongRunningApplicationTask" && s.Write.EventId.Name != "EndpointOffline").Select(s => s.Write.EventId.Name));
}

private sealed class TestStartup<THub> : IStartup
Expand Down

0 comments on commit bf92d1c

Please sign in to comment.