-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathDebugLogger.cs
35 lines (29 loc) · 1.01 KB
/
DebugLogger.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
using System;
using System.IO;
namespace Conduit
{
public class DebugLogger
{
public static DebugLogger Global = new DebugLogger("global.txt");
private StreamWriter writer;
public DebugLogger(string fileName)
{
writer = new StreamWriter(Path.Combine(Persistence.DATA_DIRECTORY, fileName), true);
writer.AutoFlush = true;
writer.WriteLine($"\n\n\n --- {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")} --- ");
writer.WriteLine($"Started logging to {fileName}...");
}
public void WriteError(string error)
{
writer.WriteLine($"[ERROR {DateTime.Now.ToString("HH:mm:ss")}] {error}");
}
public void WriteMessage(string message)
{
writer.WriteLine($"[MSG {DateTime.Now.ToString("HH:mm:ss")}] {message}");
}
public void WriteWarning(string warning)
{
writer.WriteLine($"[WRN {DateTime.Now.ToString("HH:mm:ss")}] {warning}");
}
}
}