|
Mila 0.13.48
Deep Neural Network Library
|
Abstract logging interface and static facade. More...


Public Member Functions | |
| Logger (const Logger &)=delete | |
| Logger (Logger &&)=delete | |
| virtual | ~Logger ()=default |
| virtual LogLevel | getLevel () const =0 |
| Returns the current minimum log level. | |
| virtual bool | isEnabled (LogLevel level) const =0 |
Returns true if records at level would be emitted. | |
| virtual void | log (std::string_view message, LogLevel level, const std::source_location &location=std::source_location::current())=0 |
| Emits a record at an explicitly specified level. | |
| virtual void | log_critical (std::string_view message, const std::source_location &location=std::source_location::current())=0 |
| Emits a record at Critical level. | |
| virtual void | log_debug (std::string_view message, const std::source_location &location=std::source_location::current())=0 |
| Emits a record at Debug level. | |
| virtual void | log_error (std::string_view message, const std::source_location &location=std::source_location::current())=0 |
| Emits a record at Error level. | |
| virtual void | log_info (std::string_view message, const std::source_location &location=std::source_location::current())=0 |
| Emits a record at Info level. | |
| virtual void | log_trace (std::string_view message, const std::source_location &location=std::source_location::current())=0 |
| Emits a record at Trace level. | |
| virtual void | log_warning (std::string_view message, const std::source_location &location=std::source_location::current())=0 |
| Emits a record at Warning level. | |
| Logger & | operator= (const Logger &)=delete |
| Logger & | operator= (Logger &&)=delete |
| virtual void | setLevel (LogLevel level)=0 |
| Sets the minimum level at which records are emitted. | |
Static Public Member Functions | |
| 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 Logger & | defaultLogger () |
| 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 | |
| Logger ()=default | |
Static Private Attributes | |
| static Logger * | defaultLogger_ { nullptr } |
Abstract logging interface and static facade.
Concrete sinks derive from this class and implement the virtual log_* methods. The static convenience methods (info, warning, etc.) delegate to whichever sink has been registered via setDefaultLogger().
Calling any static log method before a sink has been registered via setDefaultLogger() is a programming error and will throw std::runtime_error. Register a NullSink in test harnesses that do not require log output.
|
virtualdefault |
|
delete |


|
delete |

|
protecteddefault |
|
inlinestatic |
Emits a record at Critical level via the default logger.
| message | The pre-formatted log message. |
| location | Automatically captured call-site location. |

|
inlinestatic |
Emits a record at Debug level via the default logger.
| message | The pre-formatted log message. |
| location | Automatically captured call-site location. |

|
inlinestatic |
Returns a reference to the registered default logger.
| std::runtime_error | if no default logger has been registered. Call Mila::initialize() before making any log calls. |


|
inlinestatic |
Emits a record at Error level via the default logger.
| message | The pre-formatted log message. |
| location | Automatically captured call-site location. |


|
pure virtual |
Returns the current minimum log level.
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.
|
inlinestatic |
Emits a record at Info level via the default logger.
| message | The pre-formatted log message. |
| location | Automatically captured call-site location. |


|
pure virtual |
Returns true if records at level would be emitted.
| level | The level to test. |
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.
|
pure virtual |
Emits a record at an explicitly specified level.
| message | The pre-formatted log message. |
| level | The severity level for this record. |
| location | Automatically captured call-site location. |
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.
|
pure virtual |
Emits a record at Critical level.
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.

|
pure virtual |
Emits a record at Debug level.
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.

|
pure virtual |
Emits a record at Error level.
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.

|
pure virtual |
Emits a record at Info level.
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.

|
pure virtual |
Emits a record at Trace level.
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.

|
pure virtual |
Emits a record at Warning level.
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.



|
inlinestatic |
Registers a sink as the process-wide default logger.
The caller retains ownership. The pointer must remain valid for the lifetime of any subsequent log calls. Pass nullptr to deregister.
| logger | Pointer to the sink to register, or nullptr to clear. |


|
pure virtual |
Sets the minimum level at which records are emitted.
Implemented in Mila::Logging::ConsoleSink, Mila::Logging::FileSink, and Mila::Logging::NullSink.
|
inlinestatic |
Emits a record at Trace level via the default logger.
| message | The pre-formatted log message. |
| location | Automatically captured call-site location. |

|
inlinestatic |
Emits a record at Warning level via the default logger.
| message | The pre-formatted log message. |
| location | Automatically captured call-site location. |


|
inlinestaticprivate |