Ensure blazor client side logger checks for enabled log levels (#12928)
This commit is contained in:
parent
e7016bc67a
commit
1ea43c5492
|
|
@ -20,6 +20,11 @@ namespace Microsoft.AspNetCore.Blazor.Services
|
||||||
|
|
||||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||||
{
|
{
|
||||||
|
if (!IsEnabled(logLevel))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var formattedMessage = formatter(state, exception);
|
var formattedMessage = formatter(state, exception);
|
||||||
Console.WriteLine($"[{logLevel}] {formattedMessage}");
|
Console.WriteLine($"[{logLevel}] {formattedMessage}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue