-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLogging.cs
80 lines (58 loc) · 2.73 KB
/
Logging.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
namespace IrbImgFormat
{
public class Logging
{
private string m_className;
//- main error handler
private static Logging s_mainError;
//-------------------------------------------------------//
public enum enumErrorType
{
enumErrorType_error,
enumErrorType_warning,
enumErrorType_info
}
//-------------------------------------------------------//
public Logging(string classStr = "")
{
m_className = classStr;
}
//-------------------------------------------------------//
public bool addError(string errorStr, string info1 = null, string info2 = null, string info3 = null)
{
getMainInstance().addMSG(errorStr, enumErrorType.enumErrorType_error, m_className, info1, info2, info3);
return false;
}
//-------------------------------------------------------//
public bool addInfo(string errorStr, string info1 = null, string info2 = null, string info3 = null)
{
getMainInstance().addMSG(errorStr, enumErrorType.enumErrorType_info, m_className, info1, info2, info3);
return false;
}
//-------------------------------------------------------//
public bool addWarning(string errorStr, string info1 = null, string info2 = null, string info3 = null)
{
getMainInstance().addMSG(errorStr, enumErrorType.enumErrorType_warning, m_className, info1, info2, info3);
return false;
}
//-------------------------------------------------------//
public static void addAnonymousError(string errorStr, string className = "", string info1 = null, string info2 = null, string info3 = null)
{
getMainInstance().addMSG(errorStr, enumErrorType.enumErrorType_error, className, info1, info2, info3);
}
//-------------------------------------------------------//
protected static Logging getMainInstance()
{
if (s_mainError == null) s_mainError = new Logging("");
return s_mainError;
}
//-------------------------------------------------------//
protected void addMSG(string errorStr, enumErrorType ErrorType, string classStr, string errorStr2 = null, string errorStr3 = null, string errorStr4 = null)
{
System.Diagnostics.Debug.WriteLine(classStr + " " + errorStr + " " + errorStr2);
System.DateTime ErrorTimeStamp = System.DateTime.Now;
System.Console.WriteLine(ErrorType + "/t" + ErrorTimeStamp + "/t" + errorStr + "/t" + classStr + "/t" + errorStr2 + "/t" + errorStr3 + "/t" + errorStr4);
}
}
}