admin管理员组文章数量:1221410
using signalR in Javascript client. (backend is asp core).
I want to disable the console logging for signalr. basically, to stop this:
I have done this (but makes no difference):
var connection = new signalR.HubConnectionBuilder().withUrl("./NotificationUserHub").build();
connection.serverTimeoutInMilliseconds = 100000;
connection.logging = false;
someone please correct me?
thanks
using signalR in Javascript client. (backend is asp.net core).
I want to disable the console logging for signalr. basically, to stop this:
I have done this (but makes no difference):
var connection = new signalR.HubConnectionBuilder().withUrl("./NotificationUserHub").build();
connection.serverTimeoutInMilliseconds = 100000;
connection.logging = false;
someone please correct me?
thanks
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Nov 25, 2019 at 11:21 Andrew SimpsonAndrew Simpson 7,32412 gold badges87 silver badges194 bronze badges3 Answers
Reset to default 17You just need to add this to your code .configureLogging(signalR.LogLevel.None)
like this:
var connection = new signalR.HubConnectionBuilder().configureLogging(signalR.LogLevel.None).withUrl("./NotificationUserHub").build();
You can see more log levels in the Microsoft Documentation.
May 2022 update:
import { HubConnectionBuilder, LogLevel } from "@microsoft/signalr";
const connection = new HubConnectionBuilder()
.withUrl()
.withAutomaticReconnect()
.configureLogging(LogLevel.None)
.build();
I found a way to disable logging.
import { ILogger, LogLevel, HubConnectionBuilder } from "@aspnet/signalr";
export class MyLogger implements ILogger {
log(logLevel: LogLevel, message: string) {
// Use `message` and `logLevel` to record the log message to your own system
}
}
// later on, when configuring your connection...
let connection = new HubConnectionBuilder()
.withUrl("/my/hub/url")
.configureLogging(new MyLogger())
.build();
This might help someone.
本文标签: javascriptDisable signalr console loggingStack Overflow
版权声明:本文标题:javascript - Disable signalr console logging - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739261400a2155384.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论