Skip to content

Commit e1a85f6

Browse files
committed
doc: 增加过滤减少日志
1 parent 6e3921a commit e1a85f6

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/BootstrapBlazor.Server/Extensions/ServiceCollectionExtensions.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the Apache 2.0 License
33
// See the LICENSE file in the project root for more information.
44
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
@@ -18,8 +18,12 @@ public static IServiceCollection AddBootstrapBlazorServerService(this IServiceCo
1818
// 增加中文编码支持网页源码显示汉字
1919
services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
2020

21-
// 增加错误日志
22-
services.AddLogging(logging => logging.AddFileLogger());
21+
// 增加错误日志,并过滤已知的防伪 Token 解密噪音日志
22+
services.AddLogging(logging =>
23+
{
24+
logging.AddFileLogger();
25+
logging.AddFilter("Microsoft.AspNetCore.Antiforgery", LogLevel.None);
26+
});
2327

2428
// 增加多语言支持配置信息
2529
services.AddRequestLocalization<IOptions<BootstrapBlazorOptions>>((localizerOption, blazorOption) =>

0 commit comments

Comments
 (0)