From 0c03008bef4db704a18612b2de55b29b4a9c2962 Mon Sep 17 00:00:00 2001 From: Robert Haken Date: Mon, 29 Apr 2024 17:07:41 +0200 Subject: [PATCH] [Blazor] Logging - comments for "magic numbers" (#32455) --- aspnetcore/blazor/fundamentals/logging.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aspnetcore/blazor/fundamentals/logging.md b/aspnetcore/blazor/fundamentals/logging.md index 20c529b3fd..3aefe4e137 100644 --- a/aspnetcore/blazor/fundamentals/logging.md +++ b/aspnetcore/blazor/fundamentals/logging.md @@ -704,7 +704,7 @@ Blazor Web App: Blazor.start({ circuit: { configureSignalR: function (builder) { - builder.configureLogging(2); + builder.configureLogging(2); // LogLevel.Information } } }); @@ -720,7 +720,7 @@ Blazor Server: @@ -728,6 +728,9 @@ Blazor Server: In the preceding example, the `{BLAZOR SCRIPT}` placeholder is the Blazor script path and file name. For the location of the script, see . +> [!NOTE] +> Using an integer to specify the logging level in Example 2, often referred to as a *magic number* or *magic constant*, is considered a poor coding practice because the integer doesn't clearly identify the logging level when viewing the source code. If minimizing the bytes transferred to the browser is a priority, using an integer might be justified (consider removing the comment in such cases). + For more information on Blazor startup (`Blazor.start()`), see . ## SignalR client logging with app configuration