-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathLog.cs
37 lines (32 loc) · 1.24 KB
/
Log.cs
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
using BepInEx.Logging;
using Microsoft.Extensions.Logging;
using System;
namespace VsTwitch
{
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static ILoggerFactory CreateLoggerFactory(Func<string?, string?, Microsoft.Extensions.Logging.LogLevel, bool> filter)
{
ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
{
builder
.AddFilter(filter)
.AddConsole();
});
return loggerFactory;
}
internal static void Debug(object data) => _logSource.LogDebug(data);
internal static void Error(object data) => _logSource.LogError(data);
internal static void Exception(System.Exception data) => _logSource.LogError(data);
internal static void Fatal(object data) => _logSource.LogFatal(data);
internal static void Info(object data) => _logSource.LogInfo(data);
internal static void Message(object data) => _logSource.LogMessage(data);
internal static void Warning(object data) => _logSource.LogWarning(data);
}
}