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

A stream that allows capturing all messages and redirecting them to error contexts. More...

#include <error_context_stream.h>

Inheritance diagram for qx::error_context_stream:
qx::base_logger_stream qx::rtti_root< naming_strategy_t > qx::rtti_pure_base

Public Member Functions

threads_shared< on_message_delegates_map_t > & get_on_messages () noexcept
 Get on messages delegate. More...
 
threads_shared< on_error_delegate, std::recursive_mutex > & get_on_error () noexcept
 Get on error delegate. More...
 
void on_error (std::thread::id errorThreadId) noexcept
 Emit error event for all listeners. More...
 
- Public Member Functions inherited from qx::base_logger_stream
 base_logger_stream (const config &streamConfig) noexcept
 base_logger_stream object constructor More...
 
compile_pattern_result set_pattern (pattern_string_t sPattern) noexcept
 Set a message pattern that will be used for this stream. More...
 
std::optional< string_view > get_pattern () const noexcept
 Get a message pattern if present. More...
 
void log (const category &category, verbosity eVerbosity, std::thread::id threadId, std::chrono::system_clock::time_point messageTime, string_view svFile, string_view svFunction, int nLine, string_view svMessage)
 Output to stream. More...
 
void flush ()
 Flush the stream.
 
- Public Member Functions inherited from qx::rtti_root< naming_strategy_t >
template<class T >
bool is_derived_from () const noexcept
 Test exact identity or membership in the object's RTTI base chain. More...
 
template<class T >
bool is () const noexcept
 Compare the object's dynamic class identifier with T's identifier. More...
 
bool is (string_view svClassName) const noexcept
 Compare against the class name selected by the naming strategy. More...
 
bool is (const class_id &id) const noexcept
 Compare against the object's dynamic class identifier. More...
 
virtual bool is_derived_from_id (const class_id &id) const noexcept
 Test an identifier against the object's dynamic RTTI hierarchy. More...
 
virtual string_view get_class_name () const noexcept
 Get the name of the object's most-derived registered RTTI type. More...
 
virtual class_id get_class_id () const noexcept
 Get the identifier of the object's most-derived registered RTTI type. More...
 
virtual std::span< const class_id > get_inheritance_sequence () const =0
 Get the registered inheritance chain in base-to-derived order. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from qx::rtti_root< naming_strategy_t >
static constexpr bool is_derived_from_id_static (const class_id &id) noexcept
 Test an identifier against the declaring type's static RTTI hierarchy. More...
 
static constexpr string_view get_class_name_static () noexcept
 Apply the naming strategy to the declaring RTTI type's signature. More...
 
static constexpr class_id get_class_id_static () noexcept
 Create the declaring RTTI type's identifier from its type signature. More...
 
- Protected Member Functions inherited from qx::rtti_root< naming_strategy_t >
virtual bool _is_base_id (const class_id &idBase) const noexcept
 Traverse identifiers treated as bases by derived RTTI classes. More...
 

Detailed Description

A stream that allows capturing all messages and redirecting them to error contexts.

Author
Khrapov
Date
10.02.2026

Definition at line 30 of file error_context_stream.h.

Member Function Documentation

◆ get_on_error()

threads_shared< error_context_stream::on_error_delegate, std::recursive_mutex > & qx::error_context_stream::get_on_error ( )
inlinenoexcept

Get on error delegate.

Return values
-on error delegate

Definition at line 25 of file error_context_stream.inl.

◆ get_on_messages()

threads_shared< error_context_stream::on_message_delegates_map_t > & qx::error_context_stream::get_on_messages ( )
inlinenoexcept

Get on messages delegate.

Return values
-on messages delegate

Definition at line 19 of file error_context_stream.inl.

◆ on_error()

void qx::error_context_stream::on_error ( std::thread::id  errorThreadId)
inlinenoexcept

Emit error event for all listeners.

Parameters
errorThreadId- the thread where error occured

Definition at line 31 of file error_context_stream.inl.


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