[Blazor] Logging - comments for "magic numbers" (#32455)

pull/32454/head
Robert Haken 2024-04-29 17:07:41 +02:00 committed by GitHub
parent fb884a258f
commit 0c03008bef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -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:
<script>
Blazor.start({
configureSignalR: function (builder) {
builder.configureLogging(2);
builder.configureLogging(2); // LogLevel.Information
}
});
</script>
@ -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 <xref:blazor/project-structure#location-of-the-blazor-script>.
> [!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 <xref:blazor/fundamentals/startup>.
## SignalR client logging with app configuration