Skip to content

scram::Logger

This is a general purpose logger; however, its main usage is asserted to be for debugging. More...

#include <logger.h>

Inherits from boost::noncopyable

Public Functions

Name
~Logger()<br>Flashes all the logs into the standard error upon destruction.
std::ostringstream &Get(LogLevel level)<br>Returns a string stream by reference that is flushed to stderr by the Logger class destructor.
LogLevelreport_level()
voidreport_level(LogLevel level)<br>Sets the reporting level cut-off.

Detailed Description

cpp
class scram::Logger;

This is a general purpose logger; however, its main usage is asserted to be for debugging.

Warning:

  • Do not place any state-changing expressions with the LOG macro as they may not run if the report level excludes the specified level.
  • Do not place leading spaces, newline, or tabs in messages because it will mess up the level-dependent printing.

All messages are directed to the standard error in a thread-safe way. This class may be expanded and modified in future to include more levels, prefixes, and logging types if it deems necessary.

Public Functions Documentation

function ~Logger

cpp
~Logger()

Flashes all the logs into the standard error upon destruction.

function Get

cpp
std::ostringstream & Get(
    LogLevel level
)

Returns a string stream by reference that is flushed to stderr by the Logger class destructor.

Parameters:

  • level The log level for the information.

Return: Formatted output stringstream with the log level information.

function report_level

cpp
static inline LogLevel report_level()

Return: Reference to the cut-off level for reporting.

function report_level

cpp
static inline void report_level(
    LogLevel level
)

Sets the reporting level cut-off.

Parameters:

  • level The maximum level of logging.

Updated on 2025-11-11 at 16:51:07 +0000