-
Notifications
You must be signed in to change notification settings - Fork 4
/
MonitorLogger.cs
36 lines (29 loc) · 1019 Bytes
/
MonitorLogger.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
using System;
using DiscordRPC.Logging;
using StardewModdingAPI;
using RPCLogLevel = DiscordRPC.Logging.LogLevel;
using SDVLogLevel = StardewModdingAPI.LogLevel;
namespace SVRichPresence
{
public class MonitorLogger : ILogger
{
public RPCLogLevel Level { get; set; }
private readonly IMonitor Monitor;
public MonitorLogger(IMonitor monitor)
{
Monitor = monitor;
}
public void Trace(string message, params object[] args) =>
Log(message, args, SDVLogLevel.Trace);
public void Info(string message, params object[] args) => Log(message, args, SDVLogLevel.Info);
public void Warning(string message, params object[] args) =>
Log(message, args, SDVLogLevel.Warn);
public void Error(string message, params object[] args) =>
Log(message, args, SDVLogLevel.Error);
private void Log(string message, object[] args, SDVLogLevel level)
{
if (Monitor.IsVerbose)
Monitor.Log("DISCORD: " + String.Format(message, args), level);
}
}
}