You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
760 B
C++
37 lines
760 B
C++
#pragma once
|
|
#include <string>
|
|
|
|
#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(const std::string& level);
|
|
void LogDebug(const char*, ...);
|
|
void LogInfo(const char*, ...);
|
|
void LogError(const char*, ...);
|
|
void LogFatal(const char*, ...);
|
|
std::string GetLogDir();
|
|
|
|
private:
|
|
CSGLogger(const CSGLogger&);
|
|
bool m_bLogEnable;
|
|
CConcurrentQueue<CSGLogRecord>* pLogQ;
|
|
CThread* pLogThread;
|
|
LogLevel m_minLevel;
|
|
void AppendToLogQueue(LogLevel level, const std::string& str);
|
|
};
|