debug::Logger refactoring (#534)

This commit is contained in:
ChancellorIkseew 2025-06-15 03:50:58 +10:00 • committed by GitHub
parent ead46158d9
commit af4ae684cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 23 deletions

View file

@ -1,7 +1,5 @@
#pragma once
#include <fstream>
#include <mutex>
#include <sstream>
namespace debug {
@ -27,24 +25,16 @@ namespace debug {
};
class Logger {
static std::mutex mutex;
static std::string utcOffset;
static std::ofstream file;
static unsigned moduleLen;
std::string name;
static void log(
LogLevel level, const std::string& name, const std::string& message
);
public:
static void init(const std::string& filename);
static void flush();
Logger(std::string name);
Logger(const std::string& name) : name(name) {
}
void log(LogLevel level, std::string message);
LogMessage debug() {
return LogMessage(this, LogLevel::debug);
}
@ -60,7 +50,7 @@ namespace debug {
LogMessage warning() {
return LogMessage(this, LogLevel::warning);
}
/// @brief Print-debugging tool (printed without header)
LogMessage print() {
return LogMessage(this, LogLevel::print);