From 90ae1c3db92833354814484e65f8cd2eef1f5f3e Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 30 七月 2025 15:14:20 +0800
Subject: [PATCH] 1.配方列表获取完善;

---
 SourceCode/Bond/EAPSimulator/Log.h |   61 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/EAPSimulator/Log.h b/SourceCode/Bond/EAPSimulator/Log.h
new file mode 100644
index 0000000..ee28e15
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/Log.h
@@ -0,0 +1,61 @@
+#pragma once
+#include <functional>
+
+
+#define LEVEL_DEBUG		0
+#define LEVEL_INFO		1
+#define LEVEL_WARN		2
+#define LEVEL_ERROR		3
+
+
+#define LOGD(msg, ...)		CLog::GetLog()->LogFormat(LEVEL_DEBUG, "", msg, __VA_ARGS__)
+#define LOGI(msg, ...)		CLog::GetLog()->LogFormat(LEVEL_INFO, "", msg, __VA_ARGS__)
+#define LOGW(msg, ...)		CLog::GetLog()->LogFormat(LEVEL_WARN, "", msg, __VA_ARGS__)
+#define LOGE(msg, ...)		CLog::GetLog()->LogFormat(LEVEL_ERROR, "", msg, __VA_ARGS__)
+
+
+#define OT_FILE			0x01
+#define OT_ODSTRING		0x02
+#define OT_TRACE		0x04
+#define LOGBATHCH()				CLog::GetLog()->Batch()
+#define LOGNEW()				CLog::GetLog()->BatchAndNew()
+
+typedef std::function<void(int level, const char* pszMessage)> ONLOG;
+
+class CLog
+{
+public:
+	CLog();
+	~CLog();
+
+public:
+	void SetOnLogCallback(ONLOG funOnLog);
+	static CLog *GetLog(void);
+	void SetOutputTarget(int flag);
+	void SetEquipmentId(const char* pszEquipmentId);
+	static CString& GetCurTime(CString& strTime);
+	CString& MakeFilepath(CString& strFilepath);
+	CString& MakeFilepathD(CString& strFilepath, int& day);
+	void LogFormat(int nLevel, const char* pszTag, char* szMessage, ...);
+	void Log(int nLevel, const char* pszTag, const char* szMessage);
+	void SetAutoAppendTimeString(BOOL bAutoAppendTime);
+	void SetLogsDir(CString strDir);
+	void Batch();
+	BOOL BatchAndNew(int& nDay);
+
+private:
+	inline void Lock() { EnterCriticalSection(&m_criticalSection); }
+	inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
+
+private:
+	ONLOG m_funOnLog;
+	int m_nOutputTarget;
+	int m_nLevel;
+	BOOL m_bAutoAppendTime;
+	CString m_strLogsDir;
+	CString m_strEquipmentId;
+	CStdioFile m_file;
+	int m_nDay;						// 按日保存一条记录,比较此数字,以决定是否结批并创建新文件
+	CRITICAL_SECTION m_criticalSection;
+};
+

--
Gitblit v1.9.3