forked from RimWorldMod/Tech-Advancing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogOutput.cs
57 lines (52 loc) · 1.55 KB
/
LogOutput.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using Verse;
namespace TechAdvancing
{
/// <summary>
/// Class for writing log messages easily.
/// </summary>
class LogOutput
{
#if DEBUG
public static readonly bool DebugMode_TA_enabled = true;
#else
public static readonly bool DebugMode_TA_enabled = false;
#endif
/// <summary>
/// Sends a new colored log message.
/// </summary>
/// <param name="level">The severity level.</param>
/// <param name="message">The message to write.</param>
public static void WriteLogMessage(Errorlevel level, string message)
{
if ((level == Errorlevel.Debug && DebugMode_TA_enabled) || level == Errorlevel.Information)
{
Log.Message("[Tech Advancing] [" + level.ToString() + "] " + message);
}
else if (level == Errorlevel.Warning || level == Errorlevel.Potential_Error)
{
Log.Warning("[Tech Advancing] [" + level.ToString() + "] " + message);
}
else if (level == Errorlevel.Error || level == Errorlevel.Critical)
{
Log.Error("[Tech Advancing] [" + level.ToString() + "] " + message);
}
}
}
/// <summary>
/// Represents the available severity levels.
/// </summary>
public enum Errorlevel
{
Debug,
Information,
Warning,
Potential_Error,
Error,
Critical
}
}