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);
|
}
|
}
|
}
|