Update Blazor auth logging 7.0 (#27176)
parent
46bfe4a158
commit
297d86c564
|
@ -1749,35 +1749,20 @@ var connection = new HubConnectionBuilder()
|
|||
|
||||
*This section only applies to Blazor WebAssembly apps.*
|
||||
|
||||
Log messages specific to <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication?displayProperty=fullName> for the <xref:Microsoft.Extensions.Logging.LogLevel.Debug?displayProperty=nameWithType> or <xref:Microsoft.Extensions.Logging.LogLevel.Trace?displayProperty=nameWithType> logging levels using ***either*** the following approaches:
|
||||
Log Blazor authentication messages at the <xref:Microsoft.Extensions.Logging.LogLevel.Debug?displayProperty=nameWithType> or <xref:Microsoft.Extensions.Logging.LogLevel.Trace?displayProperty=nameWithType> logging levels with a log filter for <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication?displayProperty=fullName> in `Program.cs`.
|
||||
|
||||
* Add a log filter for <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication?displayProperty=fullName> in `Program.cs`:
|
||||
The following example:
|
||||
|
||||
```csharp
|
||||
#if DEBUG
|
||||
builder.Logging.AddFilter(
|
||||
"Microsoft.AspNetCore.Components.WebAssembly.Authentication",
|
||||
LogLevel.Debug);
|
||||
#endif
|
||||
```
|
||||
* Activates logging for the `Debug` build configuration using a [C# preprocessor directive](/dotnet/csharp/language-reference/preprocessor-directives).
|
||||
* Logs Blazor authentication messages at the <xref:Microsoft.Extensions.Logging.LogLevel.Debug> log level.
|
||||
|
||||
* Provide an app settings file for the `Development` environment (`wwwroot/appsettings.Development.json`) with log level configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"DetailedErrors": true,
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information",
|
||||
"Microsoft.AspNetCore.Components.WebAssembly.Authentication": "Debug"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Set the value to either "`Debug`" or "`Trace`".
|
||||
```csharp
|
||||
#if DEBUG
|
||||
builder.Logging.AddFilter(
|
||||
"Microsoft.AspNetCore.Components.WebAssembly.Authentication",
|
||||
LogLevel.Debug);
|
||||
#endif
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Blazor WebAssembly apps only log to the client-side [browser developer tools](https://developer.mozilla.org/docs/Glossary/Developer_Tools) console.
|
||||
|
|
Loading…
Reference in New Issue