From b87e68b9fc0cc599f742549afc037c3028d37cd0 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Thu, 23 Jun 2022 21:07:44 +0300 Subject: [PATCH] Add an extra method to the logger. --- module/Logger.cpp | 15 +++++++++++++++ module/Logger.hpp | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/module/Logger.cpp b/module/Logger.cpp index 06436bb1..a8a4147d 100644 --- a/module/Logger.cpp +++ b/module/Logger.cpp @@ -556,6 +556,21 @@ void Logger::ProcessMessage() } } +// ------------------------------------------------------------------------------------------------ +void Logger::Send(uint8_t level, bool sub, const char * msg) +{ + // Is this level even allowed? + if ((m_ConsoleLevels & level) || (m_LogFileLevels & level)) + { + // Create a new message builder + MsgPtr message(new Message(level, sub)); + // Generate the log message + message->Append(msg); + // Process the message in the buffer + PushMessage(message); + } +} + // ------------------------------------------------------------------------------------------------ void Logger::Send(uint8_t level, bool sub, const char * msg, size_t len) { diff --git a/module/Logger.hpp b/module/Logger.hpp index 5e687abc..7a820e08 100644 --- a/module/Logger.hpp +++ b/module/Logger.hpp @@ -409,6 +409,11 @@ public: */ void BindCb(uint8_t level, Function & func); + /* -------------------------------------------------------------------------------------------- + * Send a log message. + */ + void Send(uint8_t level, bool sub, const char * msg); + /* -------------------------------------------------------------------------------------------- * Send a log message. */