StormByte C++ Library: Logger module 1.2.0
StormByte-Logger is the logging module of the StormByte C++ suite.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
StormByte::Logger::Log Class Reference

Public streaming facade for the StormByte logger. More...

#include <StormByte/logger/log.hxx>

Inheritance diagram for StormByte::Logger::Log:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Logger::Log:
Collaboration graph
[legend]

Public Types

using PointerType = StormByte::Clonable< Log, std::shared_ptr< Log > >::PointerType
 Smart pointer returned by Clone, Move and Scope.
 

Public Member Functions

 Log (std::ostream &out, const Level &level=Level::Info, const std::string &format="[%L] %T")
 Construct a Log writing to out.
 
 Log (const Log &)=default
 Copy constructor.
 
 Log (Log &&) noexcept=default
 Move constructor.
 
 ~Log () noexcept override=default
 Destructor.
 
Logoperator= (const Log &)=default
 Copy assignment.
 
Logoperator= (Log &&) noexcept=default
 Move assignment.
 
PointerType Scope (std::string path)
 Another facade on the same backend, with a sticky component path.
 
bool Enabled (const Level &level) const noexcept
 Whether level would be emitted given the print floor.
 
virtual LogColor (const Level &level, const StormByte::Logger::Color &color)
 Set the configured color for a logging level.
 
virtual StormByte::Logger::Color Color (const Level &level) const
 Get the configured color for a logging level.
 
virtual LogColor (const std::string &component, const Level &level, const StormByte::Logger::Color &color)
 Set a color override for a component path and level.
 
virtual StormByte::Logger::Color Color (const std::string &component, const Level &level) const
 Get a component color, falling back along the path then to the general color.
 
virtual LogFormat (const std::string &format)
 Set the header format.
 
virtual const std::string & Format () const
 Get the effective current header format.
 
virtual LogFormat (const std::string &component, const std::string &format)
 Set or remove a component-specific header format.
 
virtual const std::string & Format (const std::string &component) const
 Get a component-specific format, falling back along the path then to general.
 
virtual LogThrottle (const ThrottleSpec &spec)
 Install a throttle rule.
 
virtual LogNoThrottle (const ThrottleSpec &spec)
 Remove a throttle rule with the same selectors.
 
virtual LogThrottle (double rate, std::size_t burst)
 Install a Drop rule.
 
virtual LogThrottle (double rate, std::size_t burst, ThrottlePolicy policy, std::size_t value, std::size_t period=0)
 Install a Sample or Window rule.
 
virtual LogThrottle (const Level &level, double rate, std::size_t burst)
 Install a level-scoped Drop rule.
 
virtual LogThrottle (GroupManip group, double rate, std::size_t burst)
 Install a group-scoped Drop rule.
 
virtual LogThrottle (ComponentManip component, double rate, std::size_t burst)
 Install a component-scoped Drop rule.
 
virtual LogThrottle (ComponentManip component, const Level &level, GroupManip group, double rate, std::size_t burst, ThrottlePolicy policy=ThrottlePolicy::Drop, std::size_t value=0, std::size_t period=0)
 Install an exact component/level/group rule.
 
virtual LogNoThrottle ()
 Remove all throttle rules.
 
virtual LogNoThrottle (const Level &level)
 Remove a level-scoped rule.
 
virtual LogNoThrottle (GroupManip group)
 Remove a group-scoped rule.
 
virtual LogNoThrottle (ComponentManip component)
 Remove a component-scoped rule.
 
virtual LogNoThrottle (ComponentManip component, const Level &level, GroupManip group)
 Remove an exact component/level/group rule.
 
virtual LogFlushThrottle ()
 Flush dropped summaries for all throttle rules.
 
virtual LogFlushThrottle (const ThrottleSpec &spec)
 Flush dropped summaries for matching throttle rules.
 

Protected Member Functions

Write

Forward a value or state change to Implementation.

virtual void Write (bool v)
 
virtual void Write (char v)
 
virtual void Write (signed char v)
 
virtual void Write (unsigned char v)
 
virtual void Write (short v)
 
virtual void Write (unsigned short v)
 
virtual void Write (int v)
 
virtual void Write (unsigned int v)
 
virtual void Write (long v)
 
virtual void Write (unsigned long v)
 
virtual void Write (long long v)
 
virtual void Write (unsigned long long v)
 
virtual void Write (float v)
 
virtual void Write (double v)
 
virtual void Write (long double v)
 
virtual void Write (std::string_view v)
 
virtual void Write (const char *v)
 
virtual void Write (std::wstring_view v)
 
virtual void Write (const wchar_t *v)
 
virtual void Write (std::span< const std::byte > v)
 Forward raw bytes to the implementation.
 
virtual void Write (const Level &level)
 
virtual void Write (std::ostream &(*manip)(std::ostream &))
 
virtual void Write (Log &(*manip)(Log &) noexcept)
 
virtual void Write (RedactManip m)
 Forward redaction state to the implementation.
 
virtual void Write (HexManip m)
 Forward hex-dump state to the implementation.
 
virtual void Write (NoHexManip m)
 Forward hex-dump disable to the implementation.
 
virtual void Write (ColorManip manip)
 Forward a color manipulator.
 
virtual void Write (NoColorManip manip)
 Forward a no-color manipulator.
 
virtual void Write (FormatManip manip)
 Forward a push-format manipulator.
 
virtual void Write (PopFormatManip manip)
 Forward a pop-format manipulator.
 
virtual void Write (GroupManip manip)
 Forward a group manipulator.
 
virtual void Write (ComponentManip manip)
 Forward a component push manipulator.
 
virtual void Write (PopComponentManip manip)
 Forward a component pop manipulator.
 
virtual void Write (ResetComponentManip manip)
 Forward a reset-component manipulator.
 

Friends

Loghumanreadable_number (Log &log) noexcept
 Enable human-readable formatting for numeric values.
 
Loghumanreadable_bytes (Log &log) noexcept
 Enable human-readable formatting for byte counts.
 
Lognohumanreadable (Log &log) noexcept
 Disable human-readable formatting (raw numbers).
 
Lognoredact (Log &log) noexcept
 Disable redaction until the next redact / redact(n) / redact_first(n).
 

Streaming Operators

Data overloads early-out when the current message level is filtered.

Level, stream manipulators, Log manipulators, RedactManip, HexManip and NoHexManip are always forwarded so logger state stays consistent.

std::shared_ptr< Implementation > m_impl
 Shared backend (copies of Log share it)
 
std::string m_scope_path
 Sticky component path; empty = root facade.
 
Logoperator<< (bool v)
 
Logoperator<< (char v)
 
Logoperator<< (signed char v)
 
Logoperator<< (unsigned char v)
 
Logoperator<< (short v)
 
Logoperator<< (unsigned short v)
 
Logoperator<< (int v)
 
Logoperator<< (unsigned int v)
 
Logoperator<< (long v)
 
Logoperator<< (unsigned long v)
 
Logoperator<< (long long v)
 
Logoperator<< (unsigned long long v)
 
Logoperator<< (float v)
 
Logoperator<< (double v)
 
Logoperator<< (long double v)
 
Logoperator<< (std::string_view v)
 Stream UTF-8 text.
 
Logoperator<< (const char *v)
 
Logoperator<< (std::wstring_view v)
 Stream wide text.
 
Logoperator<< (const wchar_t *v)
 
Logoperator<< (std::span< const std::byte > v)
 Stream raw bytes.
 
Logoperator<< (const Level &level)
 
Logoperator<< (std::ostream &(*manip)(std::ostream &))
 
Logoperator<< (Log &(*manip)(Log &) noexcept)
 
Logoperator<< (RedactManip m)
 Apply redaction policy (full or keep-last-N).
 
Logoperator<< (HexManip m)
 Dump subsequent payloads as hex bytes until nohex.
 
Logoperator<< (NoHexManip m)
 Disable hex dumps and restore default payload formatting.
 
Logoperator<< (ColorManip manip)
 Apply a configured or explicit content color.
 
Logoperator<< (NoColorManip manip)
 Disable color for subsequent content.
 
Logoperator<< (FormatManip manip)
 Save the current format and activate a temporary format.
 
Logoperator<< (PopFormatManip manip)
 Restore the most recently saved format.
 
Logoperator<< (GroupManip manip)
 Set the producer group for the current line.
 
Logoperator<< (ComponentManip manip)
 Push a component segment onto the current thread's stack.
 
Logoperator<< (PopComponentManip manip)
 Pop one component segment from the current thread's stack.
 
Logoperator<< (ResetComponentManip manip)
 Clear the current thread's component stack.
 
bool WillWrite () const noexcept
 Whether the current line level will be written.
 
bool PrepareLine ()
 Decide throttle admission before a payload claims a line lock.
 
bool HasOpenOutputLine () const noexcept
 Whether output has already started for the current line.
 
bool LineDecided () const noexcept
 Whether throttle has already decided the current line.
 
bool LineAdmitted () const noexcept
 Whether the decided current line is admitted.
 
PointerType Clone () const override
 Deep-copy this facade into a shared_ptr.
 
PointerType Move () override
 Move this facade into a shared_ptr.
 

Detailed Description

Public streaming facade for the StormByte logger.

Owns a shared_ptr to the internal Implementation and exposes operator<< overloads similar to std::ostream. Filtered levels early-out without I/O. The configured print level does not suppress Warning, Error or Fatal.

Text payloads use std::string_view / std::wstring_view. std::string and std::wstring convert to those views (no extra copy of the input). There is no separate operator<<(const std::string&).

Binary payloads use std::span<const std::byte>. A std::vector<std::byte> converts to that span. Default formatting is Base64; hex dumps the bytes.

Scope returns another facade that shares the Implementation (and, on ThreadedLog, the line lock) and carries a sticky component path. Format, Color and Throttle calls without an explicit component use that path. The root facade (empty path) still installs global rules.

The thread-local component stack (component / pop_component / reset_component) is independent of Scope. It only affects emission on the root facade.

Member Typedef Documentation

◆ PointerType

using StormByte::Logger::Log::PointerType = StormByte::Clonable<Log, std::shared_ptr<Log> >::PointerType

Smart pointer returned by Clone, Move and Scope.

Constructor & Destructor Documentation

◆ Log() [1/3]

StormByte::Logger::Log::Log ( std::ostream &  out,
const Level level = Level::Info,
const std::string &  format = "[%L] %T" 
)

Construct a Log writing to out.

Parameters
outOutput stream (e.g. std::cout).
levelMinimum Level that will be emitted.
formatHeader format: L level, T timestamp, i thread id, c component, g group, %% literal %.

◆ Log() [2/3]

StormByte::Logger::Log::Log ( const Log )
default

Copy constructor.

Note
Shares the Implementation. Copies the sticky component path.

◆ Log() [3/3]

StormByte::Logger::Log::Log ( Log &&  )
defaultnoexcept

Move constructor.

◆ ~Log()

StormByte::Logger::Log::~Log ( )
overridedefaultnoexcept

Destructor.

Member Function Documentation

◆ Clone()

PointerType StormByte::Logger::Log::Clone ( ) const
overrideprotected

Deep-copy this facade into a shared_ptr.

Returns
Pointer to the clone. Shares the Implementation.

◆ Color() [1/4]

virtual StormByte::Logger::Color StormByte::Logger::Log::Color ( const Level level) const
virtual

Get the configured color for a logging level.

Parameters
levelLevel whose color is requested.
Returns
Configured color. On a scoped facade this uses prefix lookup from the sticky path.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Color() [2/4]

virtual Log & StormByte::Logger::Log::Color ( const Level level,
const StormByte::Logger::Color color 
)
virtual

Set the configured color for a logging level.

Parameters
levelLevel whose color is changed.
colorColor to use for that level.
Returns
Reference to this logger.
Note
On a scoped facade this stores a component override for the sticky path.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Color() [3/4]

virtual StormByte::Logger::Color StormByte::Logger::Log::Color ( const std::string &  component,
const Level level 
) const
virtual

Get a component color, falling back along the path then to the general color.

Parameters
componentComponent path.
levelLevel whose color is requested.
Returns
Component override or general color.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Color() [4/4]

virtual Log & StormByte::Logger::Log::Color ( const std::string &  component,
const Level level,
const StormByte::Logger::Color color 
)
virtual

Set a color override for a component path and level.

Parameters
componentComponent path (Multimedia or Multimedia/Decoder).
levelLevel whose color is changed.
colorColor to use for that component and level.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Enabled()

bool StormByte::Logger::Log::Enabled ( const Level level) const
noexcept

Whether level would be emitted given the print floor.

Parameters
levelLevel to test.
Returns
true if that level is at or above the floor, or is Warning/Error/Fatal.
Note
Does not open a line and does not consult throttle admission.

◆ FlushThrottle() [1/2]

virtual Log & StormByte::Logger::Log::FlushThrottle ( )
virtual

Flush dropped summaries for all throttle rules.

Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ FlushThrottle() [2/2]

virtual Log & StormByte::Logger::Log::FlushThrottle ( const ThrottleSpec spec)
virtual

Flush dropped summaries for matching throttle rules.

Parameters
specSelectors of the rules to flush.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Format() [1/4]

virtual const std::string & StormByte::Logger::Log::Format ( ) const
virtual

Get the effective current header format.

Returns
Temporary, component-specific or general format.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Format() [2/4]

virtual const std::string & StormByte::Logger::Log::Format ( const std::string &  component) const
virtual

Get a component-specific format, falling back along the path then to general.

Parameters
componentComponent path.
Returns
Component format or general format.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Format() [3/4]

virtual Log & StormByte::Logger::Log::Format ( const std::string &  component,
const std::string &  format 
)
virtual

Set or remove a component-specific header format.

Parameters
componentComponent path; empty selects the general format.
formatFormat, or empty to remove the override.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Format() [4/4]

virtual Log & StormByte::Logger::Log::Format ( const std::string &  format)
virtual

Set the header format.

Parameters
formatFormat used by default, or for the sticky path on a scoped facade.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ HasOpenOutputLine()

bool StormByte::Logger::Log::HasOpenOutputLine ( ) const
protectednoexcept

Whether output has already started for the current line.

Returns
true when the line header has been emitted.

◆ LineAdmitted()

bool StormByte::Logger::Log::LineAdmitted ( ) const
protectednoexcept

Whether the decided current line is admitted.

Returns
true when payload output is allowed.

◆ LineDecided()

bool StormByte::Logger::Log::LineDecided ( ) const
protectednoexcept

Whether throttle has already decided the current line.

Returns
true when the line decision exists.

◆ Move()

PointerType StormByte::Logger::Log::Move ( )
overrideprotected

Move this facade into a shared_ptr.

Returns
Pointer to the new facade. The Implementation stays shared; this object is not emptied.

◆ NoThrottle() [1/6]

virtual Log & StormByte::Logger::Log::NoThrottle ( )
virtual

Remove all throttle rules.

Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ NoThrottle() [2/6]

virtual Log & StormByte::Logger::Log::NoThrottle ( ComponentManip  component)
virtual

Remove a component-scoped rule.

Parameters
componentComponent path used as-is.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ NoThrottle() [3/6]

virtual Log & StormByte::Logger::Log::NoThrottle ( ComponentManip  component,
const Level level,
GroupManip  group 
)
virtual

Remove an exact component/level/group rule.

Parameters
componentComponent path used as-is.
levelLevel selector.
groupGroup selector.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ NoThrottle() [4/6]

virtual Log & StormByte::Logger::Log::NoThrottle ( const Level level)
virtual

Remove a level-scoped rule.

Parameters
levelLevel selector.
Returns
Reference to this logger.
Note
Global on the root facade; bound to the sticky path on a scoped facade.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ NoThrottle() [5/6]

virtual Log & StormByte::Logger::Log::NoThrottle ( const ThrottleSpec spec)
virtual

Remove a throttle rule with the same selectors.

Parameters
specSelectors of the rule to remove. An absent Component uses the sticky path when scoped.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ NoThrottle() [6/6]

virtual Log & StormByte::Logger::Log::NoThrottle ( GroupManip  group)
virtual

Remove a group-scoped rule.

Parameters
groupGroup selector.
Returns
Reference to this logger.
Note
Global on the root facade; bound to the sticky path on a scoped facade.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ operator<<() [1/34]

Log & StormByte::Logger::Log::operator<< ( bool  v)
inline

◆ operator<<() [2/34]

Log & StormByte::Logger::Log::operator<< ( char  v)
inline

◆ operator<<() [3/34]

Log & StormByte::Logger::Log::operator<< ( ColorManip  manip)
inline

Apply a configured or explicit content color.

Parameters
manipColor manipulator.
Returns
Reference to this logger.

◆ operator<<() [4/34]

Log & StormByte::Logger::Log::operator<< ( ComponentManip  manip)
inline

Push a component segment onto the current thread's stack.

Parameters
manipComponent manipulator.
Returns
Reference to this logger.

◆ operator<<() [5/34]

Log & StormByte::Logger::Log::operator<< ( const char *  v)
inline

◆ operator<<() [6/34]

Log & StormByte::Logger::Log::operator<< ( const Level level)
inline

◆ operator<<() [7/34]

Log & StormByte::Logger::Log::operator<< ( const wchar_t *  v)
inline

◆ operator<<() [8/34]

Log & StormByte::Logger::Log::operator<< ( double  v)
inline

◆ operator<<() [9/34]

Log & StormByte::Logger::Log::operator<< ( float  v)
inline

◆ operator<<() [10/34]

Log & StormByte::Logger::Log::operator<< ( FormatManip  manip)
inline

Save the current format and activate a temporary format.

Parameters
manipFormat manipulator.
Returns
Reference to this logger.

◆ operator<<() [11/34]

Log & StormByte::Logger::Log::operator<< ( GroupManip  manip)
inline

Set the producer group for the current line.

Parameters
manipGroup manipulator.
Returns
Reference to this logger.

◆ operator<<() [12/34]

Log & StormByte::Logger::Log::operator<< ( HexManip  m)
inline

Dump subsequent payloads as hex bytes until nohex.

Parameters
mHex manipulator.
Returns
Reference to this logger.

◆ operator<<() [13/34]

Log & StormByte::Logger::Log::operator<< ( int  v)
inline

◆ operator<<() [14/34]

Log & StormByte::Logger::Log::operator<< ( Log &(*)(Log &) noexcept  manip)
inline

◆ operator<<() [15/34]

Log & StormByte::Logger::Log::operator<< ( long double  v)
inline

◆ operator<<() [16/34]

Log & StormByte::Logger::Log::operator<< ( long long  v)
inline

◆ operator<<() [17/34]

Log & StormByte::Logger::Log::operator<< ( long  v)
inline

◆ operator<<() [18/34]

Log & StormByte::Logger::Log::operator<< ( NoColorManip  manip)
inline

Disable color for subsequent content.

Parameters
manipNo-color manipulator.
Returns
Reference to this logger.

◆ operator<<() [19/34]

Log & StormByte::Logger::Log::operator<< ( NoHexManip  m)
inline

Disable hex dumps and restore default payload formatting.

Parameters
mNo-hex manipulator.
Returns
Reference to this logger.

◆ operator<<() [20/34]

Log & StormByte::Logger::Log::operator<< ( PopComponentManip  manip)
inline

Pop one component segment from the current thread's stack.

Parameters
manipPop-component manipulator.
Returns
Reference to this logger.

◆ operator<<() [21/34]

Log & StormByte::Logger::Log::operator<< ( PopFormatManip  manip)
inline

Restore the most recently saved format.

Parameters
manipPop-format manipulator.
Returns
Reference to this logger.

◆ operator<<() [22/34]

Log & StormByte::Logger::Log::operator<< ( RedactManip  m)
inline

Apply redaction policy (full or keep-last-N).

State remains until noredact.

Parameters
mRedaction manipulator.
Returns
Reference to this logger.

◆ operator<<() [23/34]

Log & StormByte::Logger::Log::operator<< ( ResetComponentManip  manip)
inline

Clear the current thread's component stack.

Parameters
manipReset-component manipulator.
Returns
Reference to this logger.

◆ operator<<() [24/34]

Log & StormByte::Logger::Log::operator<< ( short  v)
inline

◆ operator<<() [25/34]

Log & StormByte::Logger::Log::operator<< ( signed char  v)
inline

◆ operator<<() [26/34]

Log & StormByte::Logger::Log::operator<< ( std::ostream &(*)(std::ostream &)  manip)
inline

◆ operator<<() [27/34]

Log & StormByte::Logger::Log::operator<< ( std::span< const std::byte >  v)
inline

Stream raw bytes.

Parameters
vContiguous bytes. std::vector<std::byte> converts to this span.
Returns
Reference to this logger.
Note
Default formatting is Base64. hex dumps 0xHH rows instead.

◆ operator<<() [28/34]

Log & StormByte::Logger::Log::operator<< ( std::string_view  v)
inline

Stream UTF-8 text.

std::string converts to this view.

Parameters
vText to write.
Returns
Reference to this logger.

◆ operator<<() [29/34]

Log & StormByte::Logger::Log::operator<< ( std::wstring_view  v)
inline

Stream wide text.

std::wstring converts to this view.

Parameters
vWide text to write.
Returns
Reference to this logger.

◆ operator<<() [30/34]

Log & StormByte::Logger::Log::operator<< ( unsigned char  v)
inline

◆ operator<<() [31/34]

Log & StormByte::Logger::Log::operator<< ( unsigned int  v)
inline

◆ operator<<() [32/34]

Log & StormByte::Logger::Log::operator<< ( unsigned long long  v)
inline

◆ operator<<() [33/34]

Log & StormByte::Logger::Log::operator<< ( unsigned long  v)
inline

◆ operator<<() [34/34]

Log & StormByte::Logger::Log::operator<< ( unsigned short  v)
inline

◆ operator=() [1/2]

Log & StormByte::Logger::Log::operator= ( const Log )
default

Copy assignment.

Returns
Reference to this logger.
Note
Shares the Implementation. Copies the sticky component path.

◆ operator=() [2/2]

Log & StormByte::Logger::Log::operator= ( Log &&  )
defaultnoexcept

Move assignment.

Returns
Reference to this logger.

◆ PrepareLine()

bool StormByte::Logger::Log::PrepareLine ( )
protected

Decide throttle admission before a payload claims a line lock.

Returns
true when the current line may emit.

◆ Scope()

PointerType StormByte::Logger::Log::Scope ( std::string  path)

Another facade on the same backend, with a sticky component path.

Parameters
pathSegment relative to this facade, or a /-separated path.
Returns
Shared pointer to a Log (ThreadedLog if *this is one). Never null.
Note
Does not register the component and does not preconfigure Format, Color or Throttle. An empty path returns a clone of this facade.

◆ Throttle() [1/7]

virtual Log & StormByte::Logger::Log::Throttle ( ComponentManip  component,
const Level level,
GroupManip  group,
double  rate,
std::size_t  burst,
ThrottlePolicy  policy = ThrottlePolicy::Drop,
std::size_t  value = 0,
std::size_t  period = 0 
)
virtual

Install an exact component/level/group rule.

Parameters
componentComponent path used as-is.
levelLevel selector.
groupGroup selector.
rateLines per second.
burstToken capacity.
policyCount policy.
valueSampleN or WindowKeep.
periodWindowPeriod when policy is Window.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Throttle() [2/7]

virtual Log & StormByte::Logger::Log::Throttle ( ComponentManip  component,
double  rate,
std::size_t  burst 
)
virtual

Install a component-scoped Drop rule.

Parameters
componentComponent path used as-is (does not use the sticky path).
rateLines per second.
burstToken capacity.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Throttle() [3/7]

virtual Log & StormByte::Logger::Log::Throttle ( const Level level,
double  rate,
std::size_t  burst 
)
virtual

Install a level-scoped Drop rule.

Parameters
levelLevel selector.
rateLines per second.
burstToken capacity.
Returns
Reference to this logger.
Note
Global on the root facade; bound to the sticky path on a scoped facade.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Throttle() [4/7]

virtual Log & StormByte::Logger::Log::Throttle ( const ThrottleSpec spec)
virtual

Install a throttle rule.

Parameters
specRule to install. An absent Component uses the sticky path when this facade is scoped.
Returns
Reference to this logger.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Throttle() [5/7]

virtual Log & StormByte::Logger::Log::Throttle ( double  rate,
std::size_t  burst 
)
virtual

Install a Drop rule.

Parameters
rateLines per second; zero disables refill.
burstInitial and maximum token capacity.
Returns
Reference to this logger.
Note
Global on the root facade; bound to the sticky path on a scoped facade.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Throttle() [6/7]

virtual Log & StormByte::Logger::Log::Throttle ( double  rate,
std::size_t  burst,
ThrottlePolicy  policy,
std::size_t  value,
std::size_t  period = 0 
)
virtual

Install a Sample or Window rule.

Parameters
rateLines per second; zero disables refill.
burstInitial and maximum token capacity.
policySample or Window.
valueSampleN or WindowKeep.
periodWindowPeriod when policy is Window.
Returns
Reference to this logger.
Note
Global on the root facade; bound to the sticky path on a scoped facade.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ Throttle() [7/7]

virtual Log & StormByte::Logger::Log::Throttle ( GroupManip  group,
double  rate,
std::size_t  burst 
)
virtual

Install a group-scoped Drop rule.

Parameters
groupGroup selector.
rateLines per second.
burstToken capacity.
Returns
Reference to this logger.
Note
Global on the root facade; bound to the sticky path on a scoped facade.

Reimplemented in StormByte::Logger::ThreadedLog.

◆ WillWrite()

bool StormByte::Logger::Log::WillWrite ( ) const
protectednoexcept

Whether the current line level will be written.

Returns
true if the current level is at or above the print floor (or always-visible).

◆ Write() [1/34]

virtual void StormByte::Logger::Log::Write ( bool  v)
protectedvirtual

◆ Write() [2/34]

virtual void StormByte::Logger::Log::Write ( char  v)
protectedvirtual

◆ Write() [3/34]

virtual void StormByte::Logger::Log::Write ( ColorManip  manip)
protectedvirtual

Forward a color manipulator.

Parameters
manipColor manipulator.

◆ Write() [4/34]

virtual void StormByte::Logger::Log::Write ( ComponentManip  manip)
protectedvirtual

Forward a component push manipulator.

Parameters
manipComponent manipulator.

◆ Write() [5/34]

virtual void StormByte::Logger::Log::Write ( const char *  v)
protectedvirtual

◆ Write() [6/34]

virtual void StormByte::Logger::Log::Write ( const Level level)
protectedvirtual

◆ Write() [7/34]

virtual void StormByte::Logger::Log::Write ( const wchar_t *  v)
protectedvirtual

◆ Write() [8/34]

virtual void StormByte::Logger::Log::Write ( double  v)
protectedvirtual

◆ Write() [9/34]

virtual void StormByte::Logger::Log::Write ( float  v)
protectedvirtual

◆ Write() [10/34]

virtual void StormByte::Logger::Log::Write ( FormatManip  manip)
protectedvirtual

Forward a push-format manipulator.

Parameters
manipFormat manipulator.

◆ Write() [11/34]

virtual void StormByte::Logger::Log::Write ( GroupManip  manip)
protectedvirtual

Forward a group manipulator.

Parameters
manipGroup manipulator.

◆ Write() [12/34]

virtual void StormByte::Logger::Log::Write ( HexManip  m)
protectedvirtual

Forward hex-dump state to the implementation.

Parameters
mHex manipulator.

◆ Write() [13/34]

virtual void StormByte::Logger::Log::Write ( int  v)
protectedvirtual

◆ Write() [14/34]

virtual void StormByte::Logger::Log::Write ( Log &(*)(Log &) noexcept  manip)
protectedvirtual

◆ Write() [15/34]

virtual void StormByte::Logger::Log::Write ( long double  v)
protectedvirtual

◆ Write() [16/34]

virtual void StormByte::Logger::Log::Write ( long long  v)
protectedvirtual

◆ Write() [17/34]

virtual void StormByte::Logger::Log::Write ( long  v)
protectedvirtual

◆ Write() [18/34]

virtual void StormByte::Logger::Log::Write ( NoColorManip  manip)
protectedvirtual

Forward a no-color manipulator.

Parameters
manipNo-color manipulator.

◆ Write() [19/34]

virtual void StormByte::Logger::Log::Write ( NoHexManip  m)
protectedvirtual

Forward hex-dump disable to the implementation.

Parameters
mNo-hex manipulator.

◆ Write() [20/34]

virtual void StormByte::Logger::Log::Write ( PopComponentManip  manip)
protectedvirtual

Forward a component pop manipulator.

Parameters
manipPop-component manipulator.

◆ Write() [21/34]

virtual void StormByte::Logger::Log::Write ( PopFormatManip  manip)
protectedvirtual

Forward a pop-format manipulator.

Parameters
manipPop-format manipulator.

◆ Write() [22/34]

virtual void StormByte::Logger::Log::Write ( RedactManip  m)
protectedvirtual

Forward redaction state to the implementation.

Parameters
mRedaction manipulator.

◆ Write() [23/34]

virtual void StormByte::Logger::Log::Write ( ResetComponentManip  manip)
protectedvirtual

Forward a reset-component manipulator.

Parameters
manipReset-component manipulator.

◆ Write() [24/34]

virtual void StormByte::Logger::Log::Write ( short  v)
protectedvirtual

◆ Write() [25/34]

virtual void StormByte::Logger::Log::Write ( signed char  v)
protectedvirtual

◆ Write() [26/34]

virtual void StormByte::Logger::Log::Write ( std::ostream &(*)(std::ostream &)  manip)
protectedvirtual

◆ Write() [27/34]

virtual void StormByte::Logger::Log::Write ( std::span< const std::byte >  v)
protectedvirtual

Forward raw bytes to the implementation.

Parameters
vContiguous bytes to format as Base64 or hex.

◆ Write() [28/34]

virtual void StormByte::Logger::Log::Write ( std::string_view  v)
protectedvirtual

◆ Write() [29/34]

virtual void StormByte::Logger::Log::Write ( std::wstring_view  v)
protectedvirtual

◆ Write() [30/34]

virtual void StormByte::Logger::Log::Write ( unsigned char  v)
protectedvirtual

◆ Write() [31/34]

virtual void StormByte::Logger::Log::Write ( unsigned int  v)
protectedvirtual

◆ Write() [32/34]

virtual void StormByte::Logger::Log::Write ( unsigned long long  v)
protectedvirtual

◆ Write() [33/34]

virtual void StormByte::Logger::Log::Write ( unsigned long  v)
protectedvirtual

◆ Write() [34/34]

virtual void StormByte::Logger::Log::Write ( unsigned short  v)
protectedvirtual

Friends And Related Symbol Documentation

◆ humanreadable_bytes

Log & humanreadable_bytes ( Log log)
friend

Enable human-readable formatting for byte counts.

Parameters
logThe Log instance to modify.
Returns
Reference to the same Log.

◆ humanreadable_number

Log & humanreadable_number ( Log log)
friend

Enable human-readable formatting for numeric values.

Parameters
logThe Log instance to modify.
Returns
Reference to the same Log.

◆ nohumanreadable

Log & nohumanreadable ( Log log)
friend

Disable human-readable formatting (raw numbers).

Parameters
logThe Log instance to modify.
Returns
Reference to the same Log.

◆ noredact

Log & noredact ( Log log)
friend

Disable redaction until the next redact / redact(n) / redact_first(n).

Parameters
logThe Log instance to modify.
Returns
Reference to the same Log.

Member Data Documentation

◆ m_impl

std::shared_ptr<Implementation> StormByte::Logger::Log::m_impl
protected

Shared backend (copies of Log share it)

◆ m_scope_path

std::string StormByte::Logger::Log::m_scope_path
protected

Sticky component path; empty = root facade.


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