mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-16 13:08:31 +00:00
Public release of the DLU server code!
Have fun!
This commit is contained in:
33
dCommon/dLogger.h
Normal file
33
dCommon/dLogger.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include <ctime>
|
||||
#include <cstdarg>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
class dLogger {
|
||||
public:
|
||||
dLogger(const std::string& outpath, bool logToConsole);
|
||||
~dLogger();
|
||||
|
||||
void SetLogToConsole(bool logToConsole) { m_logToConsole = logToConsole; }
|
||||
|
||||
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);
|
||||
|
||||
void Flush();
|
||||
|
||||
const bool GetIsLoggingToConsole() const { return m_logToConsole; }
|
||||
|
||||
private:
|
||||
bool m_logToConsole;
|
||||
std::string m_outpath;
|
||||
std::ofstream mFile;
|
||||
|
||||
#ifndef _WIN32
|
||||
//Glorious linux can run with SPEED:
|
||||
FILE* fp = nullptr;
|
||||
#endif
|
||||
};
|
||||
Reference in New Issue
Block a user