utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
utility::logging::StandardLogger Class Reference

Standard output/error logger implementation. More...

#include <headers/utility/logging/standard_logger.hpp>

Inheritance diagram for utility::logging::StandardLogger:
Collaboration diagram for utility::logging::StandardLogger:

Public Member Functions

 StandardLogger (const std::string &name)
 Constructor with logger name.
 
 ~StandardLogger (void) override
 Destructor ensuring output streams are flushed.
 
void output (const LogRecord &record) override
 Output a formatted log record to the appropriate stream.
 
- Public Member Functions inherited from utility::logging::Logger
 Logger (const std::string &name)
 Default constructor.
 
virtual ~Logger (void)=default
 Virtual destructor for proper cleanup.
 
void setMinLevel (LogLevel level) noexcept
 Set the minimum log level. Messages below this level are suppressed.
 
LogLevel getMinLevel (void) const noexcept
 Get the current minimum log level.
 
void setFlushPolicy (FlushPolicy policy) noexcept
 Set the output flush policy.
 
FlushPolicy getFlushPolicy (void) const noexcept
 Get the current output flush policy.
 
LogMessage debug (std::source_location loc=std::source_location::current())
 Begin a debug-level log message.
 
LogMessage info (std::source_location loc=std::source_location::current())
 Begin an info-level log message.
 
LogMessage warning (std::source_location loc=std::source_location::current())
 Begin a warning-level log message.
 
LogMessage error (std::source_location loc=std::source_location::current())
 Begin an error-level log message.
 
LogMessage log (LogLevel level, std::source_location loc=std::source_location::current())
 Begin a log message with dynamic level.
 
const std::string & getName (void) const
 Get the logger name.
 

Additional Inherited Members

- Static Public Member Functions inherited from utility::logging::Logger
static constexpr LogLevel defaultMinLevel (void) noexcept
 Default minimum level for the current build type.
 
static std::string levelToString (LogLevel level)
 Get string representation of log level.
 
static std::string getTimestamp (void)
 Get current timestamp as formatted string.
 
static constexpr int levelValue (LogLevel level) noexcept
 Get numeric value of a log level for comparison.
 
- Protected Attributes inherited from utility::logging::Logger
std::mutex _mutex
 Serializes output access.
 

Detailed Description

Standard output/error logger implementation.

Logs DEBUG_LEVEL and INFO_LEVEL messages to stdout, WARNING_LEVEL and ERROR_LEVEL to stderr. Adds ANSI color per level and includes source file, line, and function name in the output only for DEBUG_LEVEL.

Definition at line 46 of file standard_logger.hpp.

Constructor & Destructor Documentation

◆ StandardLogger()

utility::logging::StandardLogger::StandardLogger ( const std::string &  name)

Constructor with logger name.

Parameters
nameThe name of the logger.

Definition at line 31 of file standard_logger.cpp.

◆ ~StandardLogger()

utility::logging::StandardLogger::~StandardLogger ( void  )
override

Destructor ensuring output streams are flushed.

Definition at line 36 of file standard_logger.cpp.

Member Function Documentation

◆ output()

void utility::logging::StandardLogger::output ( const LogRecord record)
overridevirtual

Output a formatted log record to the appropriate stream.

Parameters
recordThe log record to output.

Implements utility::logging::Logger.

Definition at line 69 of file standard_logger.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: