mrDarker
2025-09-05 6b80da0fe2a6053b39802a6701db6df0ab1fde24
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
#pragma once
#include <afx.h>
 
class CLogger
{
public:
    static CLogger& Instance();  // »ñÈ¡µ¥Àý
    void WriteLine(CString str); // Ð´Ò»ÐÐÈÕÖ¾
    void CloseLogFile();         // ¹Ø±ÕÈÕÖ¾Îļþ
 
private:
    CLogger();
    ~CLogger();
    void OpenLogFile();          // ÄÚ²¿´ò¿ªÎļþ
 
    CCriticalSection m_csLogLock;
    CString m_strCurrentLogPath;
    CStdioFile m_logFile;
};
 
#define LOG_LINE(x) CLogger::Instance().WriteLine(x)
 
#define LOG_LINEF(fmt, ...)                     \
    do {                                        \
        CString __log__;                        \
        __log__.Format(fmt, __VA_ARGS__);       \
        CLogger::Instance().WriteLine(__log__); \
    } while (0)