Skip to content

Commit fc20c11

Browse files
committed
PR feedback
1 parent d95a36c commit fc20c11

File tree

4 files changed

+45
-46
lines changed

4 files changed

+45
-46
lines changed

src/Components/Components/src/RenderTree/Renderer.Log.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public static void InitializingComponent(ILogger logger, ComponentState componen
3636

3737
public static void RenderingComponent(ILogger logger, ComponentState componentState)
3838
{
39-
4039
if (logger.IsEnabled(LogLevel.Debug)) // This is almost always false, so skip the evaluations
4140
{
4241
RenderingComponent(logger, componentState.ComponentId, componentState.Component.GetType());

src/Components/Server/src/Circuits/CircuitHost.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,30 @@ public static void CircuitHandlerFailed(ILogger logger, CircuitHandler handler,
686686
[LoggerMessage(111, LogLevel.Error, "Unhandled exception in circuit '{CircuitId}'.", EventName = "CircuitUnhandledException")]
687687
public static partial void CircuitUnhandledException(ILogger logger, CircuitId circuitId, Exception exception);
688688

689+
[LoggerMessage(112, LogLevel.Debug, "About to notify client of an error in circuit '{CircuitId}'.", EventName = "CircuitTransmittingClientError")]
690+
public static partial void CircuitTransmittingClientError(ILogger logger, CircuitId circuitId);
691+
692+
[LoggerMessage(113, LogLevel.Debug, "Successfully transmitted error to client in circuit '{CircuitId}'.", EventName = "CircuitTransmittedClientErrorSuccess")]
693+
public static partial void CircuitTransmittedClientErrorSuccess(ILogger logger, CircuitId circuitId);
694+
689695
[LoggerMessage(114, LogLevel.Debug, "Failed to transmit exception to client in circuit '{CircuitId}'.", EventName = "CircuitTransmitErrorFailed")]
690696
public static partial void CircuitTransmitErrorFailed(ILogger logger, CircuitId circuitId, Exception exception);
691697

698+
[LoggerMessage(115, LogLevel.Debug, "An exception occurred on the circuit host '{CircuitId}' while the client is disconnected.", EventName = "UnhandledExceptionClientDisconnected")]
699+
public static partial void UnhandledExceptionClientDisconnected(ILogger logger, CircuitId circuitId, Exception exception);
700+
701+
[LoggerMessage(200, LogLevel.Debug, "Failed to parse the event data when trying to dispatch an event.", EventName = "DispatchEventFailedToParseEventData")]
702+
public static partial void DispatchEventFailedToParseEventData(ILogger logger, Exception ex);
703+
704+
[LoggerMessage(201, LogLevel.Debug, "There was an error dispatching the event '{EventHandlerId}' to the application.", EventName = "DispatchEventFailedToDispatchEvent")]
705+
public static partial void DispatchEventFailedToDispatchEvent(ILogger logger, string eventHandlerId, Exception ex);
706+
707+
[LoggerMessage(202, LogLevel.Debug, "Invoking instance method '{MethodIdentifier}' on instance '{DotNetObjectId}' with callback id '{CallId}'.", EventName = "BeginInvokeDotNet")]
708+
private static partial void BeginInvokeDotNet(ILogger logger, string methodIdentifier, long dotNetObjectId, string callId);
709+
710+
[LoggerMessage(203, LogLevel.Debug, "Failed to invoke instance method '{MethodIdentifier}' on instance '{DotNetObjectId}' with callback id '{CallId}'.", EventName = "BeginInvokeDotNetFailed")]
711+
private static partial void BeginInvokeDotNetFailed(ILogger logger, string methodIdentifier, long dotNetObjectId, string callId, Exception exception);
712+
692713
[LoggerMessage(204, LogLevel.Debug, "There was an error invoking 'Microsoft.JSInterop.DotNetDispatcher.EndInvoke'.", EventName = "EndInvokeDispatchException")]
693714
public static partial void EndInvokeDispatchException(ILogger logger, Exception ex);
694715

@@ -698,6 +719,18 @@ public static void CircuitHandlerFailed(ILogger logger, CircuitHandler handler,
698719
[LoggerMessage(206, LogLevel.Debug, "The JS interop call with callback id '{AsyncCall}' succeeded.", EventName = "EndInvokeJSSucceeded")]
699720
public static partial void EndInvokeJSSucceeded(ILogger logger, long asyncCall);
700721

722+
[LoggerMessage(208, LogLevel.Debug, "Location changing to {URI} in circuit '{CircuitId}'.", EventName = "LocationChange")]
723+
public static partial void LocationChange(ILogger logger, string uri, CircuitId circuitId);
724+
725+
[LoggerMessage(209, LogLevel.Debug, "Location change to '{URI}' in circuit '{CircuitId}' succeeded.", EventName = "LocationChangeSucceeded")]
726+
public static partial void LocationChangeSucceeded(ILogger logger, string uri, CircuitId circuitId);
727+
728+
[LoggerMessage(210, LogLevel.Debug, "Location change to '{URI}' in circuit '{CircuitId}' failed.", EventName = "LocationChangeFailed")]
729+
public static partial void LocationChangeFailed(ILogger logger, string uri, CircuitId circuitId, Exception exception);
730+
731+
[LoggerMessage(212, LogLevel.Debug, "Failed to complete render batch '{RenderId}' in circuit host '{CircuitId}'.", EventName = "OnRenderCompletedFailed")]
732+
public static partial void OnRenderCompletedFailed(ILogger logger, long renderId, CircuitId circuitId, Exception e);
733+
701734
[LoggerMessage(213, LogLevel.Debug, "The ReceiveByteArray call with id '{id}' succeeded.", EventName = "ReceiveByteArraySucceeded")]
702735
public static partial void ReceiveByteArraySuccess(ILogger logger, long id);
703736

@@ -710,15 +743,6 @@ public static void CircuitHandlerFailed(ILogger logger, CircuitHandler handler,
710743
[LoggerMessage(216, LogLevel.Debug, "The SendDotNetStreamAsync call with id '{id}' failed.", EventName = "SendDotNetStreamException")]
711744
public static partial void SendDotNetStreamException(ILogger logger, long id, Exception ex);
712745

713-
[LoggerMessage(200, LogLevel.Debug, "Failed to parse the event data when trying to dispatch an event.", EventName = "DispatchEventFailedToParseEventData")]
714-
public static partial void DispatchEventFailedToParseEventData(ILogger logger, Exception ex);
715-
716-
[LoggerMessage(201, LogLevel.Debug, "There was an error dispatching the event '{EventHandlerId}' to the application.", EventName = "DispatchEventFailedToDispatchEvent")]
717-
public static partial void DispatchEventFailedToDispatchEvent(ILogger logger, string eventHandlerId, Exception ex);
718-
719-
[LoggerMessage(202, LogLevel.Debug, "Invoking instance method '{MethodIdentifier}' on instance '{DotNetObjectId}' with callback id '{CallId}'.", EventName = "BeginInvokeDotNet")]
720-
private static partial void BeginInvokeDotNet(ILogger logger, string methodIdentifier, long dotNetObjectId, string callId);
721-
722746
[LoggerMessage(217, LogLevel.Debug, "Invoking static method with identifier '{MethodIdentifier}' on assembly '{Assembly}' with callback id '{CallId}'.", EventName = "BeginInvokeDotNetStatic")]
723747
private static partial void BeginInvokeDotNetStatic(ILogger logger, string methodIdentifier, string assembly, string callId);
724748

@@ -734,9 +758,6 @@ public static void BeginInvokeDotNet(ILogger logger, string callId, string assem
734758
}
735759
}
736760

737-
[LoggerMessage(203, LogLevel.Debug, "Failed to invoke instance method '{MethodIdentifier}' on instance '{DotNetObjectId}' with callback id '{CallId}'.", EventName = "BeginInvokeDotNetFailed")]
738-
private static partial void BeginInvokeDotNetFailed(ILogger logger, string methodIdentifier, long dotNetObjectId, string callId, Exception exception);
739-
740761
[LoggerMessage(218, LogLevel.Debug, "Failed to invoke static method with identifier '{MethodIdentifier}' on assembly '{Assembly}' with callback id '{CallId}'.", EventName = "BeginInvokeDotNetFailed")]
741762
private static partial void BeginInvokeDotNetStaticFailed(ILogger logger, string methodIdentifier, string assembly, string callId, Exception exception);
742763

@@ -752,29 +773,8 @@ public static void BeginInvokeDotNetFailed(ILogger logger, string callId, string
752773
}
753774
}
754775

755-
[LoggerMessage(208, LogLevel.Debug, "Location changing to {URI} in circuit '{CircuitId}'.", EventName = "LocationChange")]
756-
public static partial void LocationChange(ILogger logger, string uri, CircuitId circuitId);
757-
758-
[LoggerMessage(209, LogLevel.Debug, "Location change to '{URI}' in circuit '{CircuitId}' succeeded.", EventName = "LocationChangeSucceeded")]
759-
public static partial void LocationChangeSucceeded(ILogger logger, string uri, CircuitId circuitId);
760-
761-
[LoggerMessage(210, LogLevel.Debug, "Location change to '{URI}' in circuit '{CircuitId}' failed.", EventName = "LocationChangeFailed")]
762-
public static partial void LocationChangeFailed(ILogger logger, string uri, CircuitId circuitId, Exception exception);
763-
764776
[LoggerMessage(219, LogLevel.Error, "Location change to '{URI}' in circuit '{CircuitId}' failed.", EventName = "LocationChangeFailed")]
765777
public static partial void LocationChangeFailedInCircuit(ILogger logger, string uri, CircuitId circuitId, Exception exception);
766-
767-
[LoggerMessage(115, LogLevel.Debug, "An exception occurred on the circuit host '{CircuitId}' while the client is disconnected.", EventName = "UnhandledExceptionClientDisconnected")]
768-
public static partial void UnhandledExceptionClientDisconnected(ILogger logger, CircuitId circuitId, Exception exception);
769-
770-
[LoggerMessage(112, LogLevel.Debug, "About to notify client of an error in circuit '{CircuitId}'.", EventName = "CircuitTransmittingClientError")]
771-
public static partial void CircuitTransmittingClientError(ILogger logger, CircuitId circuitId);
772-
773-
[LoggerMessage(113, LogLevel.Debug, "Successfully transmitted error to client in circuit '{CircuitId}'.", EventName = "CircuitTransmittedClientErrorSuccess")]
774-
public static partial void CircuitTransmittedClientErrorSuccess(ILogger logger, CircuitId circuitId);
775-
776-
[LoggerMessage(212, LogLevel.Debug, "Failed to complete render batch '{RenderId}' in circuit host '{CircuitId}'.", EventName = "OnRenderCompletedFailed")]
777-
public static partial void OnRenderCompletedFailed(ILogger logger, long renderId, CircuitId circuitId, Exception e);
778778
}
779779
}
780780
}

src/Components/Server/src/Circuits/CircuitRegistry.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,6 @@ public static void ExceptionDisposingTokenSource(ILogger logger, Exception excep
388388
[LoggerMessage(107, LogLevel.Debug, "Failed to reconnect to a circuit with id {CircuitId}.", EventName = "FailedToReconnectToCircuit")]
389389
public static partial void FailedToReconnectToCircuit(ILogger logger, CircuitId circuitId, Exception exception = null);
390390

391-
[LoggerMessage(115, LogLevel.Debug, "Reconnect to circuit with id {CircuitId} succeeded.", EventName = "FailedToReconnectToCircuit")]
392-
public static partial void ReconnectionSucceeded(ILogger logger, CircuitId circuitId);
393-
394391
[LoggerMessage(108, LogLevel.Debug, "Attempting to disconnect circuit with id {CircuitId} from connection {ConnectionId}.", EventName = "CircuitDisconnectStarted")]
395392
public static partial void CircuitDisconnectStarted(ILogger logger, CircuitId circuitId, string connectionId);
396393

@@ -403,14 +400,17 @@ public static void ExceptionDisposingTokenSource(ILogger logger, Exception excep
403400
[LoggerMessage(111, LogLevel.Debug, "Circuit with id {CircuitId} is disconnected.", EventName = "CircuitMarkedDisconnected")]
404401
public static partial void CircuitMarkedDisconnected(ILogger logger, CircuitId circuitId);
405402

406-
[LoggerMessage(113, LogLevel.Debug, "Circuit with id {CircuitId} has been removed from the registry for permanent disconnection.", EventName = "CircuitDisconnectedPermanently")]
407-
public static partial void CircuitDisconnectedPermanently(ILogger logger, CircuitId circuitId);
408-
409403
[LoggerMessage(112, LogLevel.Debug, "Circuit with id {CircuitId} evicted due to {EvictionReason}.", EventName = "CircuitEvicted")]
410404
public static partial void CircuitEvicted(ILogger logger, CircuitId circuitId, EvictionReason evictionReason);
411405

406+
[LoggerMessage(113, LogLevel.Debug, "Circuit with id {CircuitId} has been removed from the registry for permanent disconnection.", EventName = "CircuitDisconnectedPermanently")]
407+
public static partial void CircuitDisconnectedPermanently(ILogger logger, CircuitId circuitId);
408+
412409
[LoggerMessage(114, LogLevel.Error, "Exception handler for {CircuitId} failed.", EventName = "CircuitExceptionHandlerFailed")]
413410
public static partial void CircuitExceptionHandlerFailed(ILogger logger, CircuitId circuitId, Exception exception);
411+
412+
[LoggerMessage(115, LogLevel.Debug, "Reconnect to circuit with id {CircuitId} succeeded.", EventName = "FailedToReconnectToCircuit")]
413+
public static partial void ReconnectionSucceeded(ILogger logger, CircuitId circuitId);
414414
}
415415
}
416416
}

src/Components/Server/src/Circuits/RemoteRenderer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,6 @@ private async Task CaptureAsyncExceptions(Task task)
341341

342342
private static partial class Log
343343
{
344-
[LoggerMessage(103, LogLevel.Information, "Sending data for batch failed: {Message}", EventName = "SendBatchDataFailed")]
345-
private static partial void SendBatchDataFailed(ILogger logger, string message, Exception exception);
346-
347-
public static void SendBatchDataFailed(ILogger logger, Exception exception)
348-
=> SendBatchDataFailed(logger, exception.Message, exception);
349-
350344
[LoggerMessage(100, LogLevel.Warning, "Unhandled exception rendering component: {Message}", EventName = "ExceptionRenderingComponent")]
351345
private static partial void UnhandledExceptionRenderingComponent(ILogger logger, string message, Exception exception);
352346

@@ -359,6 +353,12 @@ public static void UnhandledExceptionRenderingComponent(ILogger logger, Exceptio
359353
[LoggerMessage(102, LogLevel.Debug, "Buffering remote render because the client on connection {ConnectionId} is disconnected.", EventName = "SkipUpdateDisplayAsync")]
360354
public static partial void BufferingRenderDisconnectedClient(ILogger logger, string connectionId);
361355

356+
[LoggerMessage(103, LogLevel.Information, "Sending data for batch failed: {Message}", EventName = "SendBatchDataFailed")]
357+
private static partial void SendBatchDataFailed(ILogger logger, string message, Exception exception);
358+
359+
public static void SendBatchDataFailed(ILogger logger, Exception exception)
360+
=> SendBatchDataFailed(logger, exception.Message, exception);
361+
362362
[LoggerMessage(104, LogLevel.Debug, "Completing batch {BatchId} with error: {ErrorMessage} in {ElapsedMilliseconds}ms.", EventName = "CompletingBatchWithError")]
363363
private static partial void CompletingBatchWithError(ILogger logger, long batchId, string errorMessage, double elapsedMilliseconds);
364364

0 commit comments

Comments
 (0)