Zum Inhalt springen

To string in log (ARCH1006)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key dotnet.logging.to-string-in-log · Severity info · Category logging

Calling ToString() manually on log parameters incurs a conversion cost even when the log level is disabled. Pass the object directly.

_logger.LogInformation("Order received {Order}", order.Id.ToString());
_logger.LogInformation("Order received {Order}", order.Id);

Remove the ToString() call and pass the value as-is; let the logging infrastructure handle formatting.