-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogManager.cs
38 lines (34 loc) · 934 Bytes
/
LogManager.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
38
using System.Collections.Generic;
namespace LogsNotIncluded
{
public static class LogManager
{
private static Dictionary<string, NLog.Logger> modLoggers = new Dictionary<string, NLog.Logger>();
public static NLog.Logger GetLogger(ModInfo modInfo)
{
return GetLogger(modInfo.ID);
}
public static NLog.Logger GetLogger(string id)
{
NLog.Logger logger;
bool hasLogger = modLoggers.TryGetValue(id, out logger);
if (hasLogger)
{
return logger;
}
else
{
logger = NLog.LogManager.GetLogger(id);
modLoggers.Add(id, logger);
return logger;
}
}
public static int RegisteredAmount
{
get
{
return modLoggers.Count;
}
}
}
}