ChainCLI
A modern C++20 command-line interface library
Loading...
Searching...
No Matches
cli::logging::LogStreamBuf Class Reference

Log stream buffer with a minimum LogLevel, that redirects the buffered output to a logging function. Used to offer own streams to write to for each log level. More...

#include <log_streambuffer.h>

Inheritance diagram for cli::logging::LogStreamBuf:

Public Member Functions

 LogStreamBuf (std::shared_ptr< std::function< void(LogLevel, const std::string &)> > logFuncPtr, LogLevel lvl, LogLevel lvlMin)
 Construct a new LogStreamBuf.
 
int sync () override
 
void setMinLevel (LogLevel lvlMin)
 Set the minimum log level for this buffer.
 

Detailed Description

Log stream buffer with a minimum LogLevel, that redirects the buffered output to a logging function. Used to offer own streams to write to for each log level.

Note
Does not flush automatically on newline, call sync() or explicitly flush buffer.

Constructor & Destructor Documentation

◆ LogStreamBuf()

cli::logging::LogStreamBuf::LogStreamBuf ( std::shared_ptr< std::function< void(LogLevel, const std::string &)> >  logFuncPtr,
LogLevel  lvl,
LogLevel  lvlMin 
)
inlineexplicit

Construct a new LogStreamBuf.

Parameters
logFuncPtrThe logging function to call with the buffered output
lvlThe log level for this buffer
lvlMinThe minimum log level for this buffer

Member Function Documentation

◆ setMinLevel()

void cli::logging::LogStreamBuf::setMinLevel ( LogLevel  lvlMin)
inline

Set the minimum log level for this buffer.

Parameters
lvlMinThe new minimum log level

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