Mila 0.13.48
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Logging::NullSink Class Referenceexport

A logging sink that silently discards all records. More...

Inheritance diagram for Mila::Logging::NullSink:
Collaboration diagram for Mila::Logging::NullSink:

Public Member Functions

 NullSink ()=default
LogLevel getLevel () const override
 Returns Critical, the highest level, ensuring isEnabled() is always false for every real level passed by callers.
bool isEnabled (LogLevel) const override
 Always returns false. No record passes the filter.
void log (std::string_view, LogLevel, const std::source_location &=std::source_location::current()) override
 Discards the record.
void log_critical (std::string_view, const std::source_location &=std::source_location::current()) override
 Discards the record.
void log_debug (std::string_view, const std::source_location &=std::source_location::current()) override
 Discards the record.
void log_error (std::string_view, const std::source_location &=std::source_location::current()) override
 Discards the record.
void log_info (std::string_view, const std::source_location &=std::source_location::current()) override
 Discards the record.
void log_trace (std::string_view, const std::source_location &=std::source_location::current()) override
 Discards the record.
void log_warning (std::string_view, const std::source_location &=std::source_location::current()) override
 Discards the record.
void setLevel (LogLevel) override
 No-op. NullSink has no meaningful level.
Public Member Functions inherited from Mila::Logging::Logger
 Logger (const Logger &)=delete
 Logger (Logger &&)=delete
virtual ~Logger ()=default
Loggeroperator= (const Logger &)=delete
Loggeroperator= (Logger &&)=delete

Additional Inherited Members

Static Public Member Functions inherited from Mila::Logging::Logger
static void critical (std::string_view message, const std::source_location &location=std::source_location::current())
 Emits a record at Critical level via the default logger.
static void debug (std::string_view message, const std::source_location &location=std::source_location::current())
 Emits a record at Debug level via the default logger.
static LoggerdefaultLogger ()
 Returns a reference to the registered default logger.
static void error (std::string_view message, const std::source_location &location=std::source_location::current())
 Emits a record at Error level via the default logger.
static void info (std::string_view message, const std::source_location &location=std::source_location::current())
 Emits a record at Info level via the default logger.
static void setDefaultLogger (Logger *logger)
 Registers a sink as the process-wide default logger.
static void trace (std::string_view message, const std::source_location &location=std::source_location::current())
 Emits a record at Trace level via the default logger.
static void warning (std::string_view message, const std::source_location &location=std::source_location::current())
 Emits a record at Warning level via the default logger.
Protected Member Functions inherited from Mila::Logging::Logger
 Logger ()=default

Detailed Description

A logging sink that silently discards all records.

All emit methods are no-ops. isEnabled() always returns false, allowing callers that guard expensive message construction behind an isEnabled() check to short-circuit at zero cost.

// Typical wiring in a test harness:
auto sink = std::make_shared<Mila::Logging::NullSink>();
static void setDefaultLogger(Logger *logger)
Registers a sink as the process-wide default logger.
Definition Logger.ixx:87

Constructor & Destructor Documentation

◆ NullSink()

Mila::Logging::NullSink::NullSink ( )
default

Member Function Documentation

◆ getLevel()

LogLevel Mila::Logging::NullSink::getLevel ( ) const
inlineoverridevirtual

Returns Critical, the highest level, ensuring isEnabled() is always false for every real level passed by callers.

Implements Mila::Logging::Logger.

◆ isEnabled()

bool Mila::Logging::NullSink::isEnabled ( LogLevel ) const
inlineoverridevirtual

Always returns false. No record passes the filter.

Implements Mila::Logging::Logger.

◆ log()

void Mila::Logging::NullSink::log ( std::string_view ,
LogLevel ,
const std::source_location & = std::source_location::current() )
inlineoverridevirtual

Discards the record.

Implements Mila::Logging::Logger.

◆ log_critical()

void Mila::Logging::NullSink::log_critical ( std::string_view ,
const std::source_location & = std::source_location::current() )
inlineoverridevirtual

Discards the record.

Implements Mila::Logging::Logger.

◆ log_debug()

void Mila::Logging::NullSink::log_debug ( std::string_view ,
const std::source_location & = std::source_location::current() )
inlineoverridevirtual

Discards the record.

Implements Mila::Logging::Logger.

◆ log_error()

void Mila::Logging::NullSink::log_error ( std::string_view ,
const std::source_location & = std::source_location::current() )
inlineoverridevirtual

Discards the record.

Implements Mila::Logging::Logger.

◆ log_info()

void Mila::Logging::NullSink::log_info ( std::string_view ,
const std::source_location & = std::source_location::current() )
inlineoverridevirtual

Discards the record.

Implements Mila::Logging::Logger.

◆ log_trace()

void Mila::Logging::NullSink::log_trace ( std::string_view ,
const std::source_location & = std::source_location::current() )
inlineoverridevirtual

Discards the record.

Implements Mila::Logging::Logger.

◆ log_warning()

void Mila::Logging::NullSink::log_warning ( std::string_view ,
const std::source_location & = std::source_location::current() )
inlineoverridevirtual

Discards the record.

Implements Mila::Logging::Logger.

◆ setLevel()

void Mila::Logging::NullSink::setLevel ( LogLevel )
inlineoverridevirtual

No-op. NullSink has no meaningful level.

Implements Mila::Logging::Logger.


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