-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathSocketLogging.cs
More file actions
44 lines (37 loc) · 1.2 KB
/
SocketLogging.cs
File metadata and controls
44 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
using Microsoft.Extensions.Logging;
namespace BootstrapBlazor.Socket.Logging;
/// <summary>
/// Socket 日志记录类
/// </summary>
public static class SocketLogging
{
private static ILogger? _logger;
private static bool _inited;
/// <summary>
/// 返回 是否已经初始化
/// </summary>
public static bool Inited => _inited;
/// <summary>
/// 初始化 ILogger 实例
/// </summary>
/// <param name="logger"></param>
public static void Init(ILogger logger)
{
_inited = true;
_logger = logger;
}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
public static void LogError(string message) => _logger?.LogError(message);
/// <summary>
///
/// </summary>
/// <param name="ex"></param>
/// <param name="message"></param>
public static void LogError(Exception ex, string? message) => _logger?.LogError(ex, message);
}