format + README

This commit is contained in:
Nicholas Orlowsky 2025-02-04 11:44:34 -05:00
parent 71be773d49
commit 0ebdb34601
Signed by: nickorlow
GPG key ID: 838827D8C4611687
12 changed files with 370 additions and 345 deletions

View file

@ -1,22 +1,29 @@
#include "./log.hpp"
namespace anthracite::log {
enum LOG_LEVEL Logger::_level = LOG_LEVEL_NONE;
enum LOG_LEVEL Logger::_level = LOG_LEVEL_NONE;
// TODO: implement logger as a singleton to prevent duplicates
Logger::Logger() = default;
void Logger::initialize(enum LOG_LEVEL level) {
_level = level;
// TODO: implement logger as a singleton to prevent duplicates
Logger::Logger() = default;
void Logger::initialize(enum LOG_LEVEL level)
{
_level = level;
}
LogBuf::LogBuf(std::ostream& output_stream, const std::string& tag, enum LOG_LEVEL level)
: _output_stream(output_stream)
, _tag(tag)
, _level(level)
{
}
int LogBuf::sync()
{
if (this->_level <= logger._level) {
std::cout << "[" << this->_tag << "] " << this->str();
std::cout.flush();
}
LogBuf::LogBuf(std::ostream& output_stream, const std::string& tag, enum LOG_LEVEL level) : _output_stream(output_stream), _tag(tag), _level(level) {}
int LogBuf::sync() {
if (this->_level <= logger._level) {
std::cout << "[" << this ->_tag << "] " << this->str();
std::cout.flush();
}
this->str("");
return 0;
}
this->str("");
return 0;
}
};