Skip to content

Commit 771bfb1

Browse files
committed
More clean up
1 parent 6df404a commit 771bfb1

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

src/Servers/Kestrel/Transport.Quic/src/Internal/IQuicTrace.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Experimental.Quic.Intern
88
{
99
internal interface IQuicTrace : ILogger
1010
{
11-
void NewConnection(string connectionId);
12-
void NewStream(string streamId);
11+
void AcceptedConnection(string connectionId);
12+
void AcceptedStream(string streamId);
1313
void ConnectionError(string connectionId, Exception ex);
1414
void StreamError(string streamId, Exception ex);
1515
void StreamPause(string streamId);
1616
void StreamResume(string streamId);
1717
void StreamShutdownWrite(string streamId, string reason);
18-
void StreamAbort(string streamId, Exception ex);
18+
void StreamAbort(string streamId, string reason);
1919
}
2020
}

src/Servers/Kestrel/Transport.Quic/src/Internal/QuicConnectionContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public QuicConnectionContext(QuicConnection connection, QuicTransportContext con
3232
Features.Set<ITlsConnectionFeature>(new FakeTlsConnectionFeature());
3333
Features.Set<IProtocolErrorCodeFeature>(this);
3434

35-
_log.NewConnection(ConnectionId);
35+
_log.AcceptedConnection(ConnectionId);
3636
}
3737

3838
public ValueTask<ConnectionContext> StartUnidirectionalStreamAsync()

src/Servers/Kestrel/Transport.Quic/src/Internal/QuicStreamContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public override void Abort(ConnectionAbortedException abortReason)
306306

307307
_aborted = true;
308308

309-
_log.StreamAbort(ConnectionId, abortReason);
309+
_log.StreamAbort(ConnectionId, abortReason.Message);
310310

311311
lock (_shutdownLock)
312312
{

src/Servers/Kestrel/Transport.Quic/src/Internal/QuicTrace.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Experimental.Quic.Intern
99
internal class QuicTrace : IQuicTrace
1010
{
1111
private static readonly Action<ILogger, string, Exception?> _acceptedConnection =
12-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(1, nameof(NewConnection)), @"Connection id ""{ConnectionId}"" accepted.");
12+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(1, "AcceptedConnection"), @"Connection id ""{ConnectionId}"" accepted.");
1313
private static readonly Action<ILogger, string, Exception?> _acceptedStream =
14-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(2, nameof(NewStream)), @"Stream id ""{ConnectionId}"" accepted.");
15-
private static readonly Action<ILogger, string, string, Exception?> _connectionError =
16-
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(3, nameof(ConnectionError)), @"Connection id ""{ConnectionId}"" hit an exception: ""{Reason}"".");
17-
private static readonly Action<ILogger, string, string, Exception?> _streamError =
18-
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(4, nameof(StreamError)), @"Connection id ""{ConnectionId}"" hit an exception: ""{Reason}"".");
14+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(2, "AcceptedStream"), @"Stream id ""{ConnectionId}"" accepted.");
15+
private static readonly Action<ILogger, string, Exception?> _connectionError =
16+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(3, "ConnectionError"), @"Connection id ""{ConnectionId}"" unexpected error.");
17+
private static readonly Action<ILogger, string, Exception?> _streamError =
18+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(4, "StreamError"), @"Stream id ""{ConnectionId}"" unexpected error.");
1919
private static readonly Action<ILogger, string, Exception?> _streamPause =
20-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(5, nameof(StreamPause)), @"Stream id ""{ConnectionId}"" paused.");
20+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(5, "StreamPause"), @"Stream id ""{ConnectionId}"" paused.");
2121
private static readonly Action<ILogger, string, Exception?> _streamResume =
22-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(6, nameof(StreamResume)), @"Stream id ""{ConnectionId}"" resumed.");
22+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(6, "StreamResume"), @"Stream id ""{ConnectionId}"" resumed.");
2323
private static readonly Action<ILogger, string, string, Exception?> _streamShutdownWrite =
24-
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(7, nameof(StreamShutdownWrite)), @"Stream id ""{ConnectionId}"" shutting down writes because: ""{Reason}"".");
24+
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(7, "StreamShutdownWrite"), @"Stream id ""{ConnectionId}"" shutting down writes because: ""{Reason}"".");
2525
private static readonly Action<ILogger, string, string, Exception?> _streamAborted =
26-
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(8, nameof(StreamShutdownWrite)), @"Stream id ""{ConnectionId}"" aborted by application, exception: ""{Reason}"".");
26+
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(8, "StreamAbort"), @"Stream id ""{ConnectionId}"" aborted by application because: ""{Reason}"".");
2727

2828
private ILogger _logger;
2929

@@ -39,24 +39,24 @@ public QuicTrace(ILogger logger)
3939
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
4040
=> _logger.Log(logLevel, eventId, state, exception, formatter);
4141

42-
public void NewConnection(string connectionId)
42+
public void AcceptedConnection(string connectionId)
4343
{
4444
_acceptedConnection(_logger, connectionId, null);
4545
}
4646

47-
public void NewStream(string streamId)
47+
public void AcceptedStream(string streamId)
4848
{
4949
_acceptedStream(_logger, streamId, null);
5050
}
5151

5252
public void ConnectionError(string connectionId, Exception ex)
5353
{
54-
_connectionError(_logger, connectionId, ex.Message, ex);
54+
_connectionError(_logger, connectionId, ex);
5555
}
5656

5757
public void StreamError(string streamId, Exception ex)
5858
{
59-
_streamError(_logger, streamId, ex.Message, ex);
59+
_streamError(_logger, streamId, ex);
6060
}
6161

6262
public void StreamPause(string streamId)
@@ -74,9 +74,9 @@ public void StreamShutdownWrite(string streamId, string reason)
7474
_streamShutdownWrite(_logger, streamId, reason, null);
7575
}
7676

77-
public void StreamAbort(string streamId, Exception ex)
77+
public void StreamAbort(string streamId, string reason)
7878
{
79-
_streamAborted(_logger, streamId, ex.Message, ex);
79+
_streamAborted(_logger, streamId, reason, null);
8080
}
8181
}
8282
}

src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketsTrace.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@ internal class SocketsTrace : ISocketsTrace
1111
// ConnectionRead: Reserved: 3
1212

1313
private static readonly Action<ILogger, string, Exception?> _connectionPause =
14-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(4, nameof(ConnectionPause)), @"Connection id ""{ConnectionId}"" paused.");
14+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(4, "ConnectionPause"), @"Connection id ""{ConnectionId}"" paused.");
1515

1616
private static readonly Action<ILogger, string, Exception?> _connectionResume =
17-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(5, nameof(ConnectionResume)), @"Connection id ""{ConnectionId}"" resumed.");
17+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(5, "ConnectionResume"), @"Connection id ""{ConnectionId}"" resumed.");
1818

1919
private static readonly Action<ILogger, string, Exception?> _connectionReadFin =
20-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(6, nameof(ConnectionReadFin)), @"Connection id ""{ConnectionId}"" received FIN.");
20+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(6, "ConnectionReadFin"), @"Connection id ""{ConnectionId}"" received FIN.");
2121

2222
private static readonly Action<ILogger, string, string, Exception?> _connectionWriteFin =
23-
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(7, nameof(ConnectionWriteFin)), @"Connection id ""{ConnectionId}"" sending FIN because: ""{Reason}""");
23+
LoggerMessage.Define<string, string>(LogLevel.Debug, new EventId(7, "ConnectionWriteFin"), @"Connection id ""{ConnectionId}"" sending FIN because: ""{Reason}""");
2424

2525
// ConnectionWrite: Reserved: 11
2626

2727
// ConnectionWriteCallback: Reserved: 12
2828

2929
private static readonly Action<ILogger, string, Exception?> _connectionError =
30-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(14, nameof(ConnectionError)), @"Connection id ""{ConnectionId}"" communication error.");
30+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(14, "ConnectionError"), @"Connection id ""{ConnectionId}"" communication error.");
3131

3232
private static readonly Action<ILogger, string, Exception?> _connectionReset =
33-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(19, nameof(ConnectionReset)), @"Connection id ""{ConnectionId}"" reset.");
33+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(19, "ConnectionReset"), @"Connection id ""{ConnectionId}"" reset.");
3434

3535
private readonly ILogger _logger;
3636

0 commit comments

Comments
 (0)