18 |
[Flags] |
[Flags] |
19 |
public enum loggerflags :ushort |
public enum loggerflags :ushort |
20 |
{ |
{ |
21 |
NONE = 0x0000, // 000 |
NONE = 0x0000, // 00000 |
22 |
INFO = 0x0001, // 001 |
INFO = 0x0001, // 00001 |
23 |
DEBUG = 0x0002, // 010 |
DEBUG = 0x0002, // 00010 |
24 |
ERROR= 0x0004, // 100 |
ERROR= 0x0004, // 00100 |
25 |
|
VERBOSE_DEBUG = 0x0008, // 01000 |
26 |
|
VERBOSE_ERROR = 0x0010, // 10000 |
27 |
DEFAULT = INFO | ERROR | DEBUG, |
DEFAULT = INFO | ERROR | DEBUG, |
28 |
ALL = DEFAULT, |
ALL = DEFAULT | VERBOSE_DEBUG | VERBOSE_ERROR |
29 |
} |
} |
30 |
public static class logger |
public static class logger |
31 |
{ |
{ |
53 |
public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.DEBUG)) { xlogger.Write(CreateNewFormat(format), args); } } |
public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.DEBUG)) { xlogger.Write(CreateNewFormat(format), args); } } |
54 |
public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.DEBUG)) { xlogger.WriteLine(CreateNewFormat(format), args); } } |
public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.DEBUG)) { xlogger.WriteLine(CreateNewFormat(format), args); } } |
55 |
} |
} |
56 |
|
public static class VerboseDebug |
57 |
|
{ |
58 |
|
private static string CreateNewFormat(string format) { return " " + CreateTimeStamp() + "(VERBOSE DEBUG) " + format; } |
59 |
|
public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_DEBUG)) { xlogger.Write(CreateNewFormat(format), args); } } |
60 |
|
public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_DEBUG)) { xlogger.WriteLine(CreateNewFormat(format), args); } } |
61 |
|
} |
62 |
public static class Error |
public static class Error |
63 |
{ |
{ |
64 |
private static string CreateNewFormat(string format) { return " " + CreateTimeStamp() + "(ERROR) " + format; } |
private static string CreateNewFormat(string format) { return " " + CreateTimeStamp() + "(ERROR) " + format; } |
65 |
public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.Write(CreateNewFormat(format), args); } } |
public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.Write(CreateNewFormat(format), args); } } |
66 |
public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.WriteLine(CreateNewFormat(format), args); } } |
public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.WriteLine(CreateNewFormat(format), args); } } |
67 |
} |
} |
68 |
|
public static class VerboseError |
69 |
|
{ |
70 |
|
private static string CreateNewFormat(string format) { return " " + CreateTimeStamp() + "(VERBOSE ERROR) " + format; } |
71 |
|
public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_ERROR)) { xlogger.Write(CreateNewFormat(format), args); } } |
72 |
|
public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_ERROR)) { xlogger.WriteLine(CreateNewFormat(format), args); } } |
73 |
|
} |
74 |
#region Force logging |
#region Force logging |
75 |
public static class ForceLog |
public static class ForceLog |
76 |
{ |
{ |