천호석
2023-05-22 dd06a37c5c3249db1b6d51d32782e7f027baf7c7
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using System;
using System.Text;
using log4net;
using log4net.Appender;
using log4net.Layout;
using log4net.Repository.Hierarchy;
 
namespace SA_LTT
{
    /* 로그 파일경로 형식은 모두 똑같이 해야 함.
     * 형식 : rootPath\yyyy\mm\fileName_dd.log
     * 확장자는 변경 해도 무관.
    */
    public class EquipmentLogManager
    {
        public delegate void AddProcessLogEvent(string logData);
        private static readonly Lazy<EquipmentLogManager> _instatnce = new Lazy<EquipmentLogManager>(() => new EquipmentLogManager());
 
        public static EquipmentLogManager Instance
        {
            get
            {
                return _instatnce.Value;
            }
        }
 
        LogCreater _exceptionLog = new LogCreater("Exception", s_exceptionLogPath);
        LogCreater _alarmOccurredLog = new LogCreater("AlarmOccurred", s_alarmOccurredLogPath);
        LogCreater _alarmChangedLog = new LogCreater("AlarmChanged", s_alarmChangedLogPath);
        LogCreater _tmcSequenceLog = new LogCreater("TmcSequence", s_tmcSequenceLogPath);
        LogCreater _pmcSequenceLog = new LogCreater("PmcSequence", s_pmcSequenceLogPath);
        LogCreater _buttonLog = new LogCreater("Button", s_buttonLogPath);
        LogCreater _energyDropCheckLog = new LogCreater("EnergyDropCheck", s_energyDropCheckLogPath);
        LogCreater _attenuatorCalLog = new LogCreater("AttenuatorCal", s_attenuatorCalLogPath);
        LogCreater _porecessLog = new LogCreater("Process", s_processLogPath);
        LogCreater _preAlignLog = new LogCreater("PreAlign", s_preAlignLogPath);
        LogCreater _energyMeterLog = new LogCreater("EnergyMeter", s_energyMeterLogPath);
        LogCreater _energyMeasureLog = new LogCreater("EnergyMeasure", s_energyMeasureLogPath);
        LogCreater _visionLog = new LogCreater("Vision", s_visionLogPath);
 
        private EquipmentLogManager()
        {
 
        }
 
        public event AddProcessLogEvent ProcessLogAdded;
 
        public static readonly string s_exceptionLogPath = $@"D:\Log\Exception\";
        public static readonly string s_alarmOccurredLogPath = $@"D:\Log\AlarmOccurred\";
        public static readonly string s_alarmChangedLogPath = $@"D:\Log\AlarmChanged\";
        public static readonly string s_tmcSequenceLogPath = $@"D:\Log\TmcSequence\";
        public static readonly string s_pmcSequenceLogPath = $@"D:\Log\PmcSequence\";
        public static readonly string s_buttonLogPath = $@"D:\Log\Button\";
        public static readonly string s_energyDropCheckLogPath = $@"D:\Log\EnergyDropCheck\";
        public static readonly string s_attenuatorCalLogPath = $@"D:\Log\AttenuatorCal\";
        public static readonly string s_processLogPath = $@"D:\Log\Process\";
        public static readonly string s_preAlignLogPath = $@"D:\Log\PreAlign\";
        public static readonly string s_energyMeterLogPath = $@"D:\Log\EnergyMeter\";
        public static readonly string s_energyMeasureLogPath = $@"D:\Log\EnergyMeasure\";
        public static readonly string s_visionLogPath = $@"D:\Log\Vision\";
 
        public void WriteExceptionLog(string message)
        {
            _exceptionLog.WriteLog(message);
        }
 
        public void WriteAlarmOccurredLog(string message)
        {
            _alarmOccurredLog.WriteLog(message);
        }
 
        public void WriteAlarmChangedLog(string message)
        {
            _alarmChangedLog.WriteLog(message);
        }
 
        public void WriteTmcSequenceLog(string message)
        {
            _tmcSequenceLog.WriteLog(message);
        }
 
        public void WritePmcSequenceLog(string message)
        {
            _pmcSequenceLog.WriteLog(message);
        }
 
        public void WriteButtonLog(string message)
        {
            _buttonLog.WriteLog(message);
        }
 
        public void WriteEnergyDropCheckLog(string message)
        {
            _energyDropCheckLog.WriteLog(message);
        }
        
        public void WriteAttenuatorCalLog(string message)
        {
            _attenuatorCalLog.WriteLog(message);
        }
 
        public void WriteProcessLog(string message)
        {
            _porecessLog.WriteLog(message);
            ProcessLogAdded?.Invoke(message);
        }
 
        public void WritePreAlignLog(string message)
        {
            _preAlignLog.WriteLog(message);
        }
 
        public void WriteEnergyMeterLog(string message)
        {
            _energyMeterLog.WriteLog(message);
        }
 
        public void WriteEnergyMeasureLog(string message)
        {
            _energyMeasureLog.WriteLog(message);
        }
 
        public void WriteVisionLog(string message)
        {
            _visionLog.WriteLog(message);
        }
    }
}