FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
ns_log::Writer Class Reference

Base class for level-specific log writers (debug, info, warn, error, critical) More...

#include <log.hpp>

Inheritance diagram for ns_log::Writer:
[legend]

Public Member Functions

 Writer (Location const &location, Level const &level, std::string prefix, std::ostream &ostream)
 Constructs a Writer with location and level information.
 
template<ns_concept::StringRepresentable T, typename... Args>
requires ( ( ns_concept::StringRepresentable<Args> or ns_concept::Iterable<Args> ) and ... )
void operator() (T &&format, Args &&... args)
 Writes a formatted log message.
 

Detailed Description

Base class for level-specific log writers (debug, info, warn, error, critical)

Handles the actual formatting and output of log messages to both the sink file (if set) and the console (if level is enabled). Thread-safe due to thread_local logger.

Definition at line 451 of file log.hpp.

Constructor & Destructor Documentation

◆ Writer()

ns_log::Writer::Writer ( Location const & location,
Level const & level,
std::string prefix,
std::ostream & ostream )
inline

Constructs a Writer with location and level information.

Parameters
locationSource code location
levelLog level for this writer
prefixSingle-character prefix for log messages
ostreamOutput stream reference (std::cout or std::cerr)

Definition at line 468 of file log.hpp.

Here is the caller graph for this function:

Member Function Documentation

◆ operator()()

template<ns_concept::StringRepresentable T, typename... Args>
requires ( ( ns_concept::StringRepresentable<Args> or ns_concept::Iterable<Args> ) and ... )
void ns_log::Writer::operator() ( T && format,
Args &&... args )
inline

Writes a formatted log message.

Template Parameters
TType of the format string (string representable)
ArgsTypes of format arguments (variadic, string representable or iterable)
Parameters
formatThe format string
argsThe format arguments

Definition at line 484 of file log.hpp.

Here is the call graph for this function:

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