禁用信号器控制台日志记录

时间:2019-11-25 11:21:38

标签: javascript logging signalr

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

我想禁用控制台的Signalr日志记录。基本上,要停止此操作:

enter image description here

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

return p.getFriends().stream()  //Stream<Profesor>
                .sorted(Comparator.comparingInt(Profesor::getId)) //Stream<Profesor>
                .map(P->P.favoritesByDist(0)) //Stream<Collection<CasaDeBurrito>>
                .flatMap(Collection::stream) //Stream<CasaDeBurrito>
                .distinct()
                .collect(Collectors.toList()); //List<CasaDeBurrito>

有人请纠正我吗?

谢谢

2 个答案:

答案 0 :(得分:0)

您只需要像这样将其添加到您的代码Duration.TotalHours([Your Hours]) 中:

.configureLogging(signalR.LogLevel.None)

您可以在Microsoft Documentation中看到更多日志级别。

答案 1 :(得分:0)

我找到了禁用日志记录的方法。

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();

这可能会帮助某人。