Mila
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.

Enumerations

enum class  Mila::Logging::LogLevel {
  Trace , Debug , Info , Warning ,
  Error , Critical , 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.

Enumeration Type Documentation

◆ LogLevel

enum class Mila::Logging::LogLevel
exportstrong

Severity levels for log records, ordered from most verbose to most severe.

A sink configured at a given level will emit all records at that level and above. For example, a sink at Warning will emit Warning, Error, and Critical records and discard Trace, Debug, and Info.

Enumerator
Trace 

Very detailed diagnostic information, typically per-operation.

Debug 

Flow-level information useful during development.

Info 

Normal operational milestones (model loaded, server ready).

Warning 

Unexpected conditions that do not prevent continued operation.

Error 

Failures that may allow the application to continue.

Critical 

Severe failures likely to cause process termination.

None 

Special sentinal level indicating no logging; not a valid record level. Always last.