2018-05-25 12:37:18 -04:00
|
|
|
#pragma once
|
2007-11-22 19:49:07 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
2019-10-16 20:51:11 -04:00
|
|
|
#include "filesystem_def.h"
|
2007-11-22 19:49:07 +00:00
|
|
|
#include "StdStream.h"
|
|
|
|
#include "Singleton.h"
|
|
|
|
|
2025-02-12 13:57:28 -05:00
|
|
|
#ifndef LOGGING_ENABLED
|
|
|
|
#ifdef _DEBUG
|
|
|
|
#define LOGGING_ENABLED 1
|
|
|
|
#else
|
|
|
|
#define LOGGING_ENABLED 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if LOGGING_ENABLED
|
|
|
|
|
2007-11-22 19:49:07 +00:00
|
|
|
class CLog : public CSingleton<CLog>
|
|
|
|
{
|
|
|
|
public:
|
2018-04-30 21:01:23 +01:00
|
|
|
CLog();
|
2018-05-22 20:36:56 -04:00
|
|
|
virtual ~CLog() = default;
|
2013-09-22 05:37:48 +00:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
void Print(const char*, const char*, ...);
|
2018-05-24 12:54:10 -04:00
|
|
|
void Warn(const char*, const char*, ...);
|
2007-11-22 19:49:07 +00:00
|
|
|
|
|
|
|
private:
|
2012-12-24 15:47:47 +00:00
|
|
|
typedef std::map<std::string, Framework::CStdStream> LogMapType;
|
2007-11-22 19:49:07 +00:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
Framework::CStdStream& GetLog(const char*);
|
2007-11-22 19:49:07 +00:00
|
|
|
|
2019-10-16 20:51:11 -04:00
|
|
|
fs::path m_logBasePath;
|
2018-04-30 21:01:23 +01:00
|
|
|
LogMapType m_logs;
|
2018-05-25 12:37:10 -04:00
|
|
|
bool m_showPrints = false;
|
2007-11-22 19:49:07 +00:00
|
|
|
};
|
2025-02-12 13:57:28 -05:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
class CLog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static CLog& GetInstance()
|
|
|
|
{
|
|
|
|
static CLog instance;
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Print(const char*, const char*, ...)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void Warn(const char*, const char*, ...)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|