mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-22 19:22:50 +00:00
30 lines
480 B
C++
30 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();
|
||
|
}
|
||
|
}
|