-
Notifications
You must be signed in to change notification settings - Fork 0
/
PowerLogger.cs
52 lines (42 loc) · 1.18 KB
/
PowerLogger.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
/// <summary>
/// A highly-reusable tool for logging in database/event viewer/filing system, all in single mode and and bulk mode.
/// It takes advantage of singleton design pattern for preventing waste of memory
/// It also has the ability to log the PowerDetector::instance().OveralErr() classes
///
/// Created and maintained By Jalal Derakhshani
/// 2020
/// </summary>
class PowerLogger
{
}
public LogOnAOSFile LogOnAOSFile()
{
return LogOnAOSFile::instance();
}
public LogOnDB LogOnDB()
{
return LogOnDB::instance();
}
public LogOnEventViewer LogOnEventViewer()
{
return LogOnEventViewer::instance();
}
private void new()
{
}
public static PowerLogger instance()
{
PowerLogger singleton;
SysGlobalCache globalCache = infolog.objectOnServer() ? appl.globalCache() : infolog.globalCache();
;
if (globalCache.isSet(classStr(PowerLogger), 0))
singleton = globalCache.get(classStr(PowerLogger), 0);
else
{
singleton = new PowerLogger();
infoLog.globalCache().set(classStr(PowerLogger), 0, singleton);
appl.globalCache().set(classStr(PowerLogger), 0, singleton);
}
return singleton;
}