You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
at the ends of lines to generate a bare return in block quote output.
18
18
-->
19
19
20
-
This article explains Blazor app logging, including configuration and how to write log messages from Razor components.
20
+
This article provides information on logging in Blazor apps, particularly in client-side logging scenarios.
21
+
22
+
For general ASP.NET Core logging guidance, including how to log from Razor components, see <xref:fundamentals/logging/index>.
21
23
22
24
## Configuration
23
25
@@ -38,101 +40,6 @@ When the app is configured in the project file to use implicit namespaces (`<Imp
38
40
39
41
Log levels conform to ASP.NET Core app log levels, which are listed in the API documentation at <xref:Microsoft.Extensions.Logging.LogLevel>.
40
42
41
-
## Razor component logging
42
-
43
-
:::moniker range="< aspnetcore-6.0"
44
-
45
-
The `using` directive for <xref:Microsoft.Extensions.Logging> is required to support [IntelliSense](/visualstudio/ide/using-intellisense) completions for APIs, such as <xref:Microsoft.Extensions.Logging.LoggerExtensions.LogWarning%2A> and <xref:Microsoft.Extensions.Logging.LoggerExtensions.LogError%2A>.
46
-
47
-
:::moniker-end
48
-
49
-
The following example:
50
-
51
-
*[Injects](xref:blazor/fundamentals/dependency-injection) an <xref:Microsoft.Extensions.Logging.ILogger> (`ILogger<Counter1>`) object to create a logger. The log's *category* is the fully qualified name of the component's type, `Counter`.
52
-
* Calls <xref:Microsoft.Extensions.Logging.LoggerExtensions.LogWarning%2A> to log at the <xref:Microsoft.Extensions.Logging.LogLevel.Warning> level.
For general ASP.NET Core logging guidance, see <xref:fundamentals/logging/index>.
135
-
136
43
## Client-side logging
137
44
138
45
Not every feature of [ASP.NET Core logging](xref:fundamentals/logging/index) is supported client-side. For example, client-side components don't have access to the client's file system or network, so writing logs to the client's physical or network storage isn't possible. When using a third-party logging service designed to work with single-page apps (SPAs), follow the service's security guidance. Keep in mind that every piece of data, including keys or secrets stored client-side are ***insecure*** and can be easily discovered by malicious users.
0 commit comments