禁用信号控制台日志记录

And*_*son 1 javascript logging signalr

在 Javascript 客户端中使用 signalR。(后端是asp.net核心)。

我想禁用信号器的控制台日志记录。基本上,要停止这个:

在此处输入图片说明

我已经这样做了(但没有区别):

var connection = new signalR.HubConnectionBuilder().withUrl("./NotificationUserHub").build();
connection.serverTimeoutInMilliseconds = 100000;
connection.logging = false;
Run Code Online (Sandbox Code Playgroud)

有人请纠正我吗?

谢谢

Kir*_*512 6

您只需要将其添加到您的代码中,.configureLogging(signalR.LogLevel.None)如下所示:

var connection = new signalR.HubConnectionBuilder().configureLogging(signalR.LogLevel.None).withUrl("./NotificationUserHub").build();
Run Code Online (Sandbox Code Playgroud)

您可以在Microsoft 文档中查看更多日志级别。