qxLib
Public Member Functions | List of all members
qx::error_context Class Reference

Collects all log messages in the scope of its lifetime and outputs them when any assertion is triggered. Particularly useful in multithreaded context where many threads write simultaneously, allowing seeing a clear thread output. More...

#include <error_context.h>

Public Member Functions

 error_context (verbosity eMinCaptureVerbosity, string_view svHeader=QXT("Error context start"), string_view svFooter=QXT("Error context end")) noexcept
 error_context object constructor More...
 

Detailed Description

Collects all log messages in the scope of its lifetime and outputs them when any assertion is triggered. Particularly useful in multithreaded context where many threads write simultaneously, allowing seeing a clear thread output.

Requires qx::error_context_stream to be added to the logger to work. Does not display anything if there were no log messages. Otherwise, it displays the header, all messages, and then the footer for visual differentiation. Doesn't catch constexpr verbosity erased messages.

Warning
Does not support fibres and coroutines (thread switching)
Author
Khrapov
Date
10.02.2026

Definition at line 32 of file error_context.h.

Constructor & Destructor Documentation

◆ error_context()

qx::error_context::error_context ( verbosity  eMinCaptureVerbosity,
string_view  svHeader = QXT("Error context start"),
string_view  svFooter = QXT("Error context end") 
)
inlinenoexcept

error_context object constructor

Parameters
eMinCaptureVerbosity- minimum verbosity of messages this context should capture
svHeader- a header to add when there is at least one message
svFooter- a footer to add when there is at least one message

Definition at line 13 of file error_context.inl.


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