iceberg-cpp
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
iceberg::Logger Class Referenceabstract

Pluggable logging sink. More...

#include <logger.h>

Inheritance diagram for iceberg::Logger:
iceberg::CapturingLogger iceberg::CerrLogger

Public Member Functions

virtual Status Initialize (const std::unordered_map< std::string, std::string > &properties)
 Property-based setup, called by Loggers::Load() before first use.
 
virtual bool ShouldLog (LogLevel level) const noexcept=0
 Cheap check whether a record at level would be emitted.
 
virtual void Log (LogMessage &&message) noexcept=0
 Emit one (already-formatted) record, taking ownership. Must not throw.
 
virtual void SetLevel (LogLevel level) noexcept=0
 Set the minimum level this logger emits.
 
virtual LogLevel level () const noexcept=0
 Return the minimum level this logger emits.
 
virtual void Flush () noexcept
 Flush any buffered output. Must not throw; best-effort on the fatal path.
 
virtual bool IsNoop () const
 Return true if this logger is a no-op.
 

Static Public Member Functions

static std::shared_ptr< LoggerNoop ()
 Return a shared, immortal no-op logger singleton.
 

Detailed Description

Pluggable logging sink.

ShouldLog() is the single authority for runtime filtering – the macros call it on every (compile-time-enabled) statement, so level changes by any path take effect immediately. Implementations must be thread-safe and must not throw. They must also obey:

Member Function Documentation

◆ Flush()

virtual void iceberg::Logger::Flush ( )
inlinevirtualnoexcept

Flush any buffered output. Must not throw; best-effort on the fatal path.

Reimplemented in iceberg::CerrLogger.

◆ Initialize()

virtual Status iceberg::Logger::Initialize ( const std::unordered_map< std::string, std::string > &  properties)
inlinevirtual

Property-based setup, called by Loggers::Load() before first use.

The base implementation applies the "level" property (parsed via LogLevelFromString); an unrecognized value is an InvalidArgument error. The spdlog backend overrides this to also apply "pattern" and then delegates to this base for "level"; CerrLogger uses the base as-is (fixed layout).

◆ level()

virtual LogLevel iceberg::Logger::level ( ) const
pure virtualnoexcept

Return the minimum level this logger emits.

Implemented in iceberg::CerrLogger, and iceberg::CapturingLogger.

◆ Log()

virtual void iceberg::Logger::Log ( LogMessage &&  message)
pure virtualnoexcept

Emit one (already-formatted) record, taking ownership. Must not throw.

Implemented in iceberg::CerrLogger, and iceberg::CapturingLogger.

◆ SetLevel()

virtual void iceberg::Logger::SetLevel ( LogLevel  level)
pure virtualnoexcept

Set the minimum level this logger emits.

Implemented in iceberg::CerrLogger, and iceberg::CapturingLogger.

◆ ShouldLog()

virtual bool iceberg::Logger::ShouldLog ( LogLevel  level) const
pure virtualnoexcept

Cheap check whether a record at level would be emitted.

Implemented in iceberg::CerrLogger, and iceberg::CapturingLogger.


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