Maze Builder Docs 8.2.1
Loading...
Searching...
No Matches
mazes::async_logger Class Referencefinal

Asynchronous logger class. More...

#include <async_logger.h>

Public Types

using sink_type = std::function<void(std::string_view)>
 Type alias for the sink function.
 

Public Member Functions

 async_logger (sink_type sink)
 
 async_logger (const async_logger &)=delete
 
async_loggeroperator= (const async_logger &)=delete
 
 async_logger (async_logger &&)=delete
 
async_loggeroperator= (async_logger &&)=delete
 
template<typename... FormatArgs>
void log (fmt::format_string< FormatArgs... > fmt_s, FormatArgs &&... args)
 Log a formatted message.
 
void log_message (std::string msg)
 Log a message.
 
void flush ()
 Flush the logger, blocking until all pending messages are processed.
 
void stop () noexcept
 Stop the logger, blocking until all pending messages are processed.
 
void set_sink (sink_type sink)
 Set the sink function for the logger.
 

Detailed Description

Asynchronous logger class.

Member Function Documentation

◆ log()

template<typename... FormatArgs>
void mazes::async_logger::log ( fmt::format_string< FormatArgs... > fmt_s,
FormatArgs &&... args )
inline

Log a formatted message.

Template Parameters
...FormatArgs
Parameters
fmt_sFormat string
...argsArguments for the format string

◆ log_message()

void mazes::async_logger::log_message ( std::string msg)
inline

Log a message.

Parameters
msgMessage to log

◆ set_sink()

void mazes::async_logger::set_sink ( sink_type sink)
inline

Set the sink function for the logger.

Parameters
sinkSink function to handle log messages

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