Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Utils::DefaultLogger Class Referenceexport
Inheritance diagram for Mila::Utils::DefaultLogger:
Collaboration diagram for Mila::Utils::DefaultLogger:

Public Member Functions

 DefaultLogger (LogLevel initialLevel=LogLevel::Info)
 
LogLevel getLevel () const override
 
bool isEnabled (LogLevel level) const override
 
void log (std::string_view message, LogLevel level, const std::source_location &location=std::source_location::current()) override
 
void log_critical (std::string_view message, const std::source_location &location=std::source_location::current()) override
 
void log_debug (std::string_view message, const std::source_location &location=std::source_location::current()) override
 
void log_error (std::string_view message, const std::source_location &location=std::source_location::current()) override
 
void log_info (std::string_view message, const std::source_location &location=std::source_location::current()) override
 
void log_trace (std::string_view message, const std::source_location &location=std::source_location::current()) override
 
void log_warning (std::string_view message, const std::source_location &location=std::source_location::current()) override
 
void setIncludeSourceLocation (bool include)
 
void setIncludeTimestamp (bool include)
 
void setLevel (LogLevel level) override
 
- Public Member Functions inherited from Mila::Utils::Logger
virtual ~Logger ()=default
 

Private Member Functions

std::string getCurrentTimestamp () const
 
std::string getLocationInfo (const std::source_location &location) const
 
void logImpl (std::string_view message, LogLevel level, const std::source_location &location)
 

Static Private Member Functions

static constexpr const char * logLevelToString (LogLevel level)
 

Private Attributes

LogLevel currentLevel_ = LogLevel::Info
 
bool includeSourceLocation_ = true
 
bool includeTimestamp_ = true
 
std::mutex logMutex_
 

Additional Inherited Members

- Static Public Member Functions inherited from Mila::Utils::Logger
static void critical (std::string_view message, const std::source_location &location=std::source_location::current())
 
template<typename... Args>
static void critical_fmt (std::format_string< Args... > fmt, Args &&... args)
 
static void debug (std::string_view message, const std::source_location &location=std::source_location::current())
 
template<typename... Args>
static void debug_fmt (std::format_string< Args... > fmt, Args &&... args)
 
static LoggerdefaultLogger ()
 
static void error (std::string_view message, const std::source_location &location=std::source_location::current())
 
template<typename... Args>
static void error_fmt (std::format_string< Args... > fmt, Args &&... args)
 
static void info (std::string_view message, const std::source_location &location=std::source_location::current())
 
template<typename... Args>
static void info_fmt (std::format_string< Args... > fmt, Args &&... args)
 
static void setDefaultLogger (Logger *logger)
 
static void trace (std::string_view message, const std::source_location &location=std::source_location::current())
 
template<typename... Args>
static void trace_fmt (std::format_string< Args... > fmt, Args &&... args)
 
static void warning (std::string_view message, const std::source_location &location=std::source_location::current())
 
template<typename... Args>
static void warning_fmt (std::format_string< Args... > fmt, Args &&... args)
 

Constructor & Destructor Documentation

◆ DefaultLogger()

Mila::Utils::DefaultLogger::DefaultLogger ( LogLevel  initialLevel = LogLevel::Info)
inline

Member Function Documentation

◆ getCurrentTimestamp()

std::string Mila::Utils::DefaultLogger::getCurrentTimestamp ( ) const
inlineprivate
Here is the caller graph for this function:

◆ getLevel()

LogLevel Mila::Utils::DefaultLogger::getLevel ( ) const
inlineoverridevirtual

Implements Mila::Utils::Logger.

◆ getLocationInfo()

std::string Mila::Utils::DefaultLogger::getLocationInfo ( const std::source_location &  location) const
inlineprivate
Here is the caller graph for this function:

◆ isEnabled()

bool Mila::Utils::DefaultLogger::isEnabled ( LogLevel  level) const
inlineoverridevirtual

Implements Mila::Utils::Logger.

Here is the caller graph for this function:

◆ log()

void Mila::Utils::DefaultLogger::log ( std::string_view  message,
LogLevel  level,
const std::source_location &  location = std::source_location::current() 
)
inlineoverridevirtual

Implements Mila::Utils::Logger.

Here is the call graph for this function:

◆ log_critical()

void Mila::Utils::DefaultLogger::log_critical ( std::string_view  message,
const std::source_location &  location = std::source_location::current() 
)
inlineoverridevirtual

Implements Mila::Utils::Logger.

Here is the call graph for this function:

◆ log_debug()

void Mila::Utils::DefaultLogger::log_debug ( std::string_view  message,
const std::source_location &  location = std::source_location::current() 
)
inlineoverridevirtual

Implements Mila::Utils::Logger.

Here is the call graph for this function:

◆ log_error()

void Mila::Utils::DefaultLogger::log_error ( std::string_view  message,
const std::source_location &  location = std::source_location::current() 
)
inlineoverridevirtual

Implements Mila::Utils::Logger.

Here is the call graph for this function:

◆ log_info()

void Mila::Utils::DefaultLogger::log_info ( std::string_view  message,
const std::source_location &  location = std::source_location::current() 
)
inlineoverridevirtual

Implements Mila::Utils::Logger.

Here is the call graph for this function:

◆ log_trace()

void Mila::Utils::DefaultLogger::log_trace ( std::string_view  message,
const std::source_location &  location = std::source_location::current() 
)
inlineoverridevirtual

Implements Mila::Utils::Logger.

Here is the call graph for this function:

◆ log_warning()

void Mila::Utils::DefaultLogger::log_warning ( std::string_view  message,
const std::source_location &  location = std::source_location::current() 
)
inlineoverridevirtual

Implements Mila::Utils::Logger.

Here is the call graph for this function:

◆ logImpl()

void Mila::Utils::DefaultLogger::logImpl ( std::string_view  message,
LogLevel  level,
const std::source_location &  location 
)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ logLevelToString()

static constexpr const char * Mila::Utils::DefaultLogger::logLevelToString ( LogLevel  level)
inlinestaticconstexprprivate
Here is the caller graph for this function:

◆ setIncludeSourceLocation()

void Mila::Utils::DefaultLogger::setIncludeSourceLocation ( bool  include)
inline

◆ setIncludeTimestamp()

void Mila::Utils::DefaultLogger::setIncludeTimestamp ( bool  include)
inline

◆ setLevel()

void Mila::Utils::DefaultLogger::setLevel ( LogLevel  level)
inlineoverridevirtual

Implements Mila::Utils::Logger.

Member Data Documentation

◆ currentLevel_

LogLevel Mila::Utils::DefaultLogger::currentLevel_ = LogLevel::Info
private

◆ includeSourceLocation_

bool Mila::Utils::DefaultLogger::includeSourceLocation_ = true
private

◆ includeTimestamp_

bool Mila::Utils::DefaultLogger::includeTimestamp_ = true
private

◆ logMutex_

std::mutex Mila::Utils::DefaultLogger::logMutex_
mutableprivate

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