/
EventLog.cs
49 lines (41 loc) · 1.17 KB
/
EventLog.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
#region References
using System.Diagnostics;
using DiagELog = System.Diagnostics.EventLog;
#endregion
namespace Server
{
public static class EventLog
{
static EventLog()
{
if (!DiagELog.SourceExists("ServUO"))
{
DiagELog.CreateEventSource("ServUO", "Application");
}
}
public static void Error(int eventID, string text)
{
DiagELog.WriteEntry("ServUO", text, EventLogEntryType.Error, eventID);
}
public static void Error(int eventID, string format, params object[] args)
{
Error(eventID, System.String.Format(format, args));
}
public static void Warning(int eventID, string text)
{
DiagELog.WriteEntry("ServUO", text, EventLogEntryType.Warning, eventID);
}
public static void Warning(int eventID, string format, params object[] args)
{
Warning(eventID, System.String.Format(format, args));
}
public static void Inform(int eventID, string text)
{
DiagELog.WriteEntry("ServUO", text, EventLogEntryType.Information, eventID);
}
public static void Inform(int eventID, string format, params object[] args)
{
Inform(eventID, System.String.Format(format, args));
}
}
}