Logger module of the StormByte suite. More...
Classes | |
| struct | ColorManip |
| Temporarily selects a configured or explicit content color. More... | |
| struct | ComponentManip |
| Selects the sticky component for the current thread. More... | |
| class | Exception |
| Root exception for Logger. More... | |
| struct | FormatManip |
| Temporarily replaces the logger format and saves the previous one. More... | |
| struct | GroupManip |
| Labels the current logging line with a producer group. More... | |
| struct | HexManip |
| Dump subsequent payloads as hex bytes until nohex. More... | |
| class | Log |
| Public streaming facade for the StormByte logger. More... | |
| struct | NoColorManip |
| Disables color for subsequent content until changed. More... | |
| struct | NoHexManip |
| Disable hex dumps and restore default payload formatting. More... | |
| struct | PopComponentManip |
| Pops one segment from the current thread's component stack. More... | |
| struct | PopFormatManip |
| Restores the most recently saved logger format. More... | |
| struct | RedactManip |
| Stateful redaction manipulator. More... | |
| struct | ResetComponentManip |
| Clears the component associated with the current thread. More... | |
| class | ThreadedLog |
| Thread-safe logging facade. More... | |
| class | ThrottleError |
| Thrown when a throttle rule is invalid. More... | |
| struct | ThrottleSpec |
| Immutable rule description used by Log::Throttle. More... | |
Concepts | |
| concept | LogPointer |
Pointer-like owner of Log or a derived logger. | |
Typedefs | |
| using | SinkWrite = void(*)(void *context, const char *data, std::size_t size) |
| Caller-side write of raw bytes into the sink. | |
| using | SinkManip = void(*)(void *context, std::ostream &(*manip)(std::ostream &)) |
Caller-side application of an std::ostream manipulator. | |
Enumerations | |
| enum class | ThrottlePolicy : unsigned char { Drop , Sample , Window } |
| Count policy applied before the optional rate bucket. More... | |
| enum class | Color : unsigned char { Default , Black , Red , Green , Yellow , Blue , Magenta , Cyan , Gray , White , BrightBlack , BrightRed , BrightGreen , BrightYellow , BrightBlue , BrightMagenta , BrightCyan , BrightWhite } |
| ANSI foreground colors supported by the logger. More... | |
| enum class | Level : unsigned short { LowLevel = 0 , Debug , Warning , Notice , Info , Error , Fatal } |
| Severity levels used by the logger. More... | |
Functions | |
| void | OStreamWrite (void *context, const char *data, std::size_t size) |
Write raw bytes into an std::ostream owned by the caller. | |
| void | OStreamManip (void *context, std::ostream &(*manip)(std::ostream &)) |
Apply an std::ostream manipulator in the caller's module. | |
| template<typename Ptr , typename T > requires LogPointer<Ptr> | |
| Ptr & | operator<< (Ptr &logger, const T &value) noexcept |
| Stream a value into a smart pointer to Log or a derived logger. | |
| template<typename Ptr > requires LogPointer<Ptr> | |
| Ptr & | operator<< (Ptr &logger, const Level &level) noexcept |
| Stream a Level into a smart pointer to Log or a derived logger. | |
| template<typename Ptr > requires LogPointer<Ptr> | |
| Ptr & | operator<< (Ptr &logger, std::ostream &(*manip)(std::ostream &)) noexcept |
| Stream a stream manipulator into a smart pointer to Log or a derived logger. | |
| GroupManip | group (StormByte::String::String name) |
| Set the producer group for the current line. | |
| GroupManip | group (std::string_view name) |
| Set the producer group from caller-owned text. | |
| ComponentManip | component (StormByte::String::String name) |
| Select the component associated with subsequent log lines on this thread. | |
| ComponentManip | component (std::string_view name) |
| Select the component from caller-owned text. | |
| FormatManip | push_format (StormByte::String::String format) |
| Save the current format and activate a temporary format. | |
| FormatManip | push_format (std::string_view format) |
| Save the current format and activate a temporary format from caller-owned text. | |
| constexpr RedactManip | redact_first (std::size_t n) noexcept |
Build a manipulator that keeps the first n characters visible. | |
| Log & | humanreadable_number (Log &log) noexcept |
| Enable human-readable formatting for numeric values. | |
| Log & | humanreadable_bytes (Log &log) noexcept |
| Enable human-readable formatting for byte counts. | |
| Log & | nohumanreadable (Log &log) noexcept |
| Disable human-readable formatting (raw numbers). | |
| Log & | noredact (Log &log) noexcept |
| Disable redaction until the next redact / redact(n) / redact_first(n). | |
| static constexpr const char * | LevelToString (const Level &l) noexcept |
| Convert a Level to a short name. | |
Variables | |
| constexpr ResetComponentManip | reset_component {} |
| Clear the current thread's component. | |
| constexpr PopComponentManip | pop_component {} |
| Pop one component segment from the current thread's stack. | |
| constexpr PopFormatManip | pop_format {} |
| Restore the most recently saved format, or do nothing if empty. | |
| constexpr ColorManip | color {} |
| Restore the configured color for the current level. | |
| constexpr NoColorManip | nocolor {} |
| Disable color for subsequent content in the current line. | |
| constexpr RedactManip | redact {} |
| Full redaction manipulator (mask everything). | |
| constexpr HexManip | hex {} |
| Enable hex dumps with 16 bytes per row. | |
| constexpr NoHexManip | nohex {} |
| Disable hex dumps for subsequent payloads. | |
| using StormByte::Logger::SinkManip = typedef void (*)(void* context, std::ostream& (*manip)(std::ostream&)) |
Caller-side application of an std::ostream manipulator.
Used for std::endl and any other stream manipulator. The call happens in the module that owns the stream.
| using StormByte::Logger::SinkWrite = typedef void (*)(void* context, const char* data, std::size_t size) |
Caller-side write of raw bytes into the sink.
The function runs in the module that created the logger, not in this DLL.
|
strong |
ANSI foreground colors supported by the logger.
Default emits no ANSI sequence and leaves the terminal color unchanged.
|
strong |
Severity levels used by the logger.
Ordered from least to most severe. Used both as the print floor and as the level of the current message. Warning, Error and Fatal are always emitted regardless of the configured print floor.
| Enumerator | |
|---|---|
| LowLevel | Verbose diagnostics. |
| Debug | Debug information. |
| Warning | Recoverable problems. |
| Notice | Significant normal events. |
| Info | Informational messages. |
| Error | Error conditions. |
| Fatal | Unrecoverable errors. |
|
strong |
|
inline |
Select the component from caller-owned text.
| name | Component name viewed in the caller; copied into an owned String. |
| ComponentManip StormByte::Logger::component | ( | StormByte::String::String | name | ) |
Select the component associated with subsequent log lines on this thread.
| name | Component name; empty selects the root component. |
|
inline |
Set the producer group from caller-owned text.
| name | Group name viewed in the caller; copied into an owned String. |
| GroupManip StormByte::Logger::group | ( | StormByte::String::String | name | ) |
Set the producer group for the current line.
| name | Group name, or empty text to clear the group. |
|
staticconstexprnoexcept |
Convert a Level to a short name.
| l | Level to convert. |
|
noexcept |
Stream a Level into a smart pointer to Log or a derived logger.
| Ptr | std::shared_ptr, std::unique_ptr, StormByte::Shared or StormByte::Unique whose element type derives from Log. |
| logger | Smart pointer to the logger. An empty owner is a no-op. |
| level | Level to set. |
|
noexcept |
Stream a value into a smart pointer to Log or a derived logger.
| Ptr | std::shared_ptr, std::unique_ptr, StormByte::Shared or StormByte::Unique whose element type derives from Log. |
| T | Value type. |
| logger | Smart pointer to the logger. An empty owner is a no-op. |
| value | Value to stream. |
|
noexcept |
Stream a stream manipulator into a smart pointer to Log or a derived logger.
A dedicated overload so overloaded manipulators such as std::endl can be resolved.
| Ptr | std::shared_ptr, std::unique_ptr, StormByte::Shared or StormByte::Unique whose element type derives from Log. |
| logger | Smart pointer to the logger. An empty owner is a no-op. |
| manip | Stream manipulator. |
|
inline |
Apply an std::ostream manipulator in the caller's module.
| context | Address of the caller's std::ostream. |
| manip | Manipulator, for example std::endl. |
|
inline |
Write raw bytes into an std::ostream owned by the caller.
Instantiated in the caller's module. The DLL only stores the function pointer.
| context | Address of the caller's std::ostream. |
| data | Bytes to write. |
| size | Number of bytes. |
|
inline |
Save the current format and activate a temporary format from caller-owned text.
| format | Format viewed in the caller; copied into an owned String. |
| FormatManip StormByte::Logger::push_format | ( | StormByte::String::String | format | ) |
Save the current format and activate a temporary format.
| format | Format to activate until pop_format is streamed. |
|
constexprnoexcept |
Build a manipulator that keeps the first n characters visible.
| n | Number of leading characters to keep unmasked. |
|
inlineconstexpr |
Restore the configured color for the current level.
|
inlineconstexpr |
Enable hex dumps with 16 bytes per row.
|
inlineconstexpr |
Disable color for subsequent content in the current line.
|
inlineconstexpr |
Disable hex dumps for subsequent payloads.
|
inlineconstexpr |
Pop one component segment from the current thread's stack.
|
inlineconstexpr |
Restore the most recently saved format, or do nothing if empty.
|
inlineconstexpr |
Full redaction manipulator (mask everything).
|
inlineconstexpr |
Clear the current thread's component.