-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logger.cs
56 lines (50 loc) · 1.4 KB
/
Logger.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using log4net;
using log4net.Config;
using System.IO;
namespace GenericDA
{
public static class Logger
{
private static ILog logAgent = LogManager.GetLogger("GenericDA");
static Logger()
{
string log4NetConfigFilePath = "log4net.config"; //Assumed log4net config will be in the same directory as GenericDA to reduce configuration
FileInfo fi = new FileInfo(log4NetConfigFilePath);
XmlConfigurator.Configure(fi);
}
public static void Debug(string message)
{
logAgent.Debug(message);
}
public static void Debug(string message, Exception ex)
{
logAgent.Debug(message, ex);
}
public static void Warn(string message)
{
if (logAgent != null)
logAgent.Warn(message);
}
public static void Fatal(string message)
{
logAgent.Fatal(message);
}
public static void Error(string message)
{
logAgent.Error(message);
}
public static void Error(string message, Exception ex)
{
logAgent.Error(message, ex);
}
public static void Info(string message)
{
logAgent.Info(message);
}
}
}