From 3d6c1183c409a2e00a916ad79481dd1d0b30cc64 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Thu, 19 Dec 2024 22:57:51 +0300 Subject: [PATCH] add logger.print --- src/debug/Logger.cpp | 6 ++++++ src/debug/Logger.hpp | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/debug/Logger.cpp b/src/debug/Logger.cpp index e8f4c95b..970b2102 100644 --- a/src/debug/Logger.cpp +++ b/src/debug/Logger.cpp @@ -23,10 +23,16 @@ Logger::Logger(std::string name) : name(std::move(name)) { void Logger::log( LogLevel level, const std::string& name, const std::string& message ) { + if (level == LogLevel::print) { + std::cout << "[" << name << "] " << message << std::endl; + return; + } + using namespace std::chrono; std::stringstream ss; switch (level) { + case LogLevel::print: case LogLevel::debug: #ifdef NDEBUG return; diff --git a/src/debug/Logger.hpp b/src/debug/Logger.hpp index 6b931fe0..9505affd 100644 --- a/src/debug/Logger.hpp +++ b/src/debug/Logger.hpp @@ -5,7 +5,7 @@ #include namespace debug { - enum class LogLevel { debug, info, warning, error }; + enum class LogLevel { print, debug, info, warning, error }; class Logger; @@ -60,5 +60,10 @@ namespace debug { LogMessage warning() { return LogMessage(this, LogLevel::warning); } + + /// @brief Print-debugging tool (printed without header) + LogMessage print() { + return LogMessage(this, LogLevel::print); + } }; }