#pragma once
#include "ConcurrentQueue.h"

class CSGLogRecord;

class CSGLogger
{
public:
    enum LogLevel {
        LOG_DEBUG=0, LOG_INFO, LOG_ERROR, LOG_FATAL
    };

    CSGLogger();
    virtual ~CSGLogger(void);
    void    SetEnableLogFile(bool bEnable);
    void    SetLogLevel(CString level);
    void    LogDebug(const char*, ...);
    void    LogInfo(const char*, ...);
    void    LogError(const char*, ...);
    void    LogFatal(const char*, ...);
    CString GetLogDir();
private:
    CSGLogger(const CSGLogger&);
    bool                            m_bLogEnable;
    CConcurrentQueue<CSGLogRecord> *pLogQ;
    CThread                        *pLogThread;
    LogLevel                        m_minLevel;
    void AppendToLogQueue(LogLevel level, CString str);
};
