24#include <unordered_map>
142 std::string pattern_;
151 static std::unordered_map<std::string, std::shared_ptr<Logger>> instances_;
160 static std::mutex instances_mutex_;
174 explicit Logger(
const std::string& name);
234 static std::shared_ptr<Logger>
getInstance(
const std::string& name);
260 void debug(
const std::string& message);
271 void info(
const std::string& message);
282 void warn(
const std::string& message);
293 void error(
const std::string& message);
304 void fatal(
const std::string& message);
364 void log(
LogLevel level,
const std::string& message);
379 std::string formatMessage(
LogLevel level,
const std::string& message);
392 std::string levelToString(
LogLevel level);
Defines the event structure used for the Observer pattern notifications.
Defines the interface for the Observer pattern component.
The Observer Interface (Abstract Base Class).
Definition IObserver.hxx:34
A thread-safe Singleton class responsible for logging system events.
Definition Logger.hxx:77
Logger(const std::string &name)
Constructor.
Definition Logger.cxx:27
void flush()
Forces all buffered log output to be written immediately (e.g., to disk).
Definition Logger.cxx:212
static void clearInstances()
Clears all registered Singleton instances.
Definition Logger.cxx:206
void warn(const std::string &message)
Logs a message at the WARN level.
Definition Logger.cxx:105
void fatal(const std::string &message)
Logs a message at the FATAL level.
Definition Logger.cxx:117
void update(const Event &event) override
Method called by the Subject to notify the observer with an event.
Definition Logger.cxx:39
~Logger() override
Destructor.
Definition Logger.cxx:33
void notify(const Event &event) override
Method called by the subject to notify the observer.
Definition Logger.cxx:74
void debug(const std::string &message)
Logs a message at the DEBUG level.
Definition Logger.cxx:93
void setPattern(const std::string &pattern)
Sets the output formatting pattern for messages.
Definition Logger.cxx:201
LogLevel getLevel() const
Retrieves the current minimum log level.
Definition Logger.cxx:197
static std::shared_ptr< Logger > getInstance(const std::string &name)
Retrieves the Singleton instance of the Logger for the given name.
Definition Logger.cxx:79
void error(const std::string &message)
Logs a message at the ERROR level.
Definition Logger.cxx:111
void setLevel(LogLevel level)
Sets the minimum log level for this instance.
Definition Logger.cxx:193
void info(const std::string &message)
Logs a message at the INFO level.
Definition Logger.cxx:99
Service layer components and infrastructure services.
LogLevel
Defines the severity levels for log messages.
Definition Logger.hxx:38
@ FATAL
Very severe error events that will likely cause the application to abort.
Definition Logger.hxx:67
@ WARN
Potentially harmful situations.
Definition Logger.hxx:55
@ INFO
General flow information.
Definition Logger.hxx:49
@ ERROR
Error events that might still allow the application to continue.
Definition Logger.hxx:61
@ DEBUG
Detailed information for debugging.
Definition Logger.hxx:43
Structure describing an event published by the VCS core.
Definition Event.hxx:30