-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDebugLogger.cs
More file actions
54 lines (47 loc) · 1.31 KB
/
Copy pathDebugLogger.cs
File metadata and controls
54 lines (47 loc) · 1.31 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
45
46
47
48
49
50
51
52
53
54
namespace BeforeTheStormAccess
{
/// <summary>
/// Centralized debug logging helpers. Only active in debug mode (F9).
/// </summary>
public static class DebugLogger
{
public static void Log(LogCategory category, string message)
{
if (!Main.DebugMode)
return;
Main.Log.LogInfo(GetPrefix(category) + " " + message);
}
public static void Log(LogCategory category, string source, string message)
{
if (!Main.DebugMode)
return;
Main.Log.LogInfo(GetPrefix(category) + " [" + source + "] " + message);
}
public static void LogScreenReader(string text)
{
if (!Main.DebugMode)
return;
Main.Log.LogInfo("[SR] " + text);
}
private static string GetPrefix(LogCategory category)
{
switch (category)
{
case LogCategory.State:
return "[STATE]";
case LogCategory.Handler:
return "[HANDLER]";
default:
return "[DEBUG]";
}
}
}
/// <summary>
/// Debug log categories.
/// </summary>
public enum LogCategory
{
State,
Handler
}
}