2021-12-05 17:54:36 +00:00
|
|
|
#pragma once
|
|
|
|
#include <ctime>
|
|
|
|
#include <cstdarg>
|
|
|
|
#include <string>
|
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
class dLogger {
|
|
|
|
public:
|
2021-12-11 12:29:34 +00:00
|
|
|
dLogger(const std::string& outpath, bool logToConsole, bool logDebugStatements);
|
2021-12-05 17:54:36 +00:00
|
|
|
~dLogger();
|
|
|
|
|
|
|
|
void SetLogToConsole(bool logToConsole) { m_logToConsole = logToConsole; }
|
2021-12-11 12:29:34 +00:00
|
|
|
void SetLogDebugStatements(bool logDebugStatements) { m_logDebugStatements = logDebugStatements; }
|
|
|
|
void vLog(const char* format, va_list args);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void LogBasic(const std::string& message);
|
|
|
|
void LogBasic(const char* format, ...);
|
|
|
|
void Log(const char* className, const char* format, ...);
|
|
|
|
void Log(const std::string& className, const std::string& message);
|
2021-12-11 12:29:34 +00:00
|
|
|
void LogDebug(const std::string& className, const std::string& message);
|
|
|
|
void LogDebug(const char* className, const char* format, ...);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void Flush();
|
|
|
|
|
|
|
|
const bool GetIsLoggingToConsole() const { return m_logToConsole; }
|
|
|
|
|
|
|
|
private:
|
2021-12-11 12:29:34 +00:00
|
|
|
bool m_logDebugStatements;
|
2021-12-05 17:54:36 +00:00
|
|
|
bool m_logToConsole;
|
|
|
|
std::string m_outpath;
|
|
|
|
std::ofstream mFile;
|
|
|
|
|
|
|
|
#ifndef _WIN32
|
|
|
|
//Glorious linux can run with SPEED:
|
|
|
|
FILE* fp = nullptr;
|
|
|
|
#endif
|
|
|
|
};
|