-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog.cs
More file actions
36 lines (32 loc) · 947 Bytes
/
Log.cs
File metadata and controls
36 lines (32 loc) · 947 Bytes
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 System.Collections.Generic;
using System.Diagnostics;
namespace ExpressBackup
{
enum LogSeverity
{
Debug = 0,
Info = 1,
Warning = 2,
Error = 3
}
static class Log
{
public static int
LogLevel = 0;
readonly static Dictionary<LogSeverity, char>
severityCode = new Dictionary<LogSeverity, char>
{
{ LogSeverity.Debug, 'D' },
{ LogSeverity.Info, 'I' },
{ LogSeverity.Warning, 'W' },
{ LogSeverity.Error, 'E' }
};
public static void Entry(LogSeverity severity, string text, params object[] args)
{
if (LogLevel > (int)severity)
return;
Trace.WriteLine(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff") + ' ' + severityCode[severity] + ": " + string.Format(text, args));
}
}
}