Hush lite wallet https://faq.hush.is/sdl
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
886 B

// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#include "LogWriter.h"
LogWriter* LogWriter::getInstance()
{
if(instance == nullptr)
instance = new LogWriter();
return instance;
}
void LogWriter::setLogFile(std::string file)
{
this->logfile = file;
}
void LogWriter::write(LogType::TYPE type, std::string message)
{
std::ofstream writer(this->logfile, std::ios::out | std::ios::app);
if(writer.good())
{
time_t now = time(0);
tm *ltm = localtime(&now);
std::stringstream ss;
ss << "[" << LogType::enum2String(type) << "] " <<
ltm->tm_mon << "-" <<
ltm->tm_mday << "-" <<
(1900 + ltm->tm_year) << " " <<
ltm->tm_hour << ":" <<
ltm->tm_min << ":" <<
ltm->tm_sec << " > " << message;
writer << ss.str() << "\n";
}
writer.close();
}