mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-22 11:12:49 +00:00
16933c24ff
Plus refactoring out the logging.
29 lines
480 B
C++
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();
|
|
}
|
|
}
|