gBar/src/Log.cpp
scorpion-26 16933c24ff Add log file
Plus refactoring out the logging.
2023-02-21 22:20:02 +01:00

29 lines
480 B
C++

#include "Log.h"
#include "Common.h"
#include <fstream>
namespace Logging
{
static std::ofstream logFile;
void Init()
{
logFile = std::ofstream("/tmp/gBar.log");
if (!logFile.is_open())
{
LOG("Cannot open logfile(/tmp/gBar.log)");
}
}
void Log(const std::string& str)
{
if (logFile.is_open())
logFile << str << std::endl;
}
void Shutdown()
{
logFile.close();
}
}