Mila 0.13.48
Deep Neural Network Library
Loading...
Searching...
No Matches
Logger.ixx File Reference

Abstract logging interface and static facade for the Mila logging infrastructure. More...

#include <source_location>
#include <stdexcept>
#include <string_view>

Classes

class  Mila::Logging::Logger
 Abstract logging interface and static facade. More...

Namespaces

namespace  Mila
 Mila main API namespace.
namespace  Mila::Logging

Enumerations

enum class  Mila::Logging::LogLevel {
  Mila::Logging::Trace , Mila::Logging::Debug , Mila::Logging::Info , Mila::Logging::Warning ,
  Mila::Logging::Error , Mila::Logging::Critical , Mila::Logging::None
}
 Severity levels for log records, ordered from most verbose to most severe. More...

Detailed Description

Abstract logging interface and static facade for the Mila logging infrastructure.

Defines the Logger base class, the LogLevel enumeration, and the static convenience methods that form the primary call-site API. Concrete sink implementations (ConsoleSink, FileSink, NullSink) derive from Logger and are registered via setDefaultLogger().

Message formatting is the caller's responsibility. Use std::format at the call site before passing the result to a log method:

auto message = std::format( "Loaded {} tensors from '{}'", count, path.string() );
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.
Definition Logger.ixx:143

A default logger must be registered via setDefaultLogger() before any log call is made. Failure to do so will throw std::runtime_error. The correct place to register is Mila::initialize(). For test harnesses that want silent logging, register a NullSink.