Skip to content

Class endstone::Logger

ClassList > endstone > Logger

Logger class which can format and output varies levels of logs.

  • #include <endstone/logger.h>

Public Types

Type Name
enum std::uint8_t Level
Specifies the log level.

Public Functions

Type Name
Logger () = default
void critical (const std::string & message) const
void critical (const fmt::format_string< Args... > format, Args &&... args) const
void debug (const std::string & message) const
void debug (const fmt::format_string< Args... > format, Args &&... args) const
void error (const std::string & message) const
void error (const fmt::format_string< Args... > format, Args &&... args) const
void error (const endstone::Error & error) const
virtual std::string_view getName () const = 0
Get the name of this Logger instance.
void info (const std::string & message) const
void info (const fmt::format_string< Args... > format, Args &&... args) const
virtual bool isEnabledFor (Level level) const = 0
Check if the Logger instance is enabled for the given logLevel .
virtual void log (Level level, const std::string & message) const = 0
Log a message at the given level.
void log (Level level, const fmt::format_string< Args... > format, Args &&... args) const
virtual void setLevel (Level level) = 0
Set the logging level for this Logger instance.
void trace (const std::string & message) const
void trace (const fmt::format_string< Args... > format, Args &&... args) const
void warning (const std::string & message) const
void warning (const fmt::format_string< Args... > format, Args &&... args) const
virtual ~Logger () = default

Public Types Documentation

enum Level

Specifies the log level.

enum endstone::Logger::Level {
    Trace = 0,
    Debug = 1,
    Info = 2,
    Warning = 3,
    Error = 4,
    Critical = 5,
    Off = 6
};


Public Functions Documentation

function Logger

endstone::Logger::Logger () = default

function critical [½]

inline void endstone::Logger::critical (
    const std::string & message
) const

function critical [2/2]

template<typename... Args>
inline void endstone::Logger::critical (
    const fmt::format_string< Args... > format,
    Args &&... args
) const

function debug [½]

inline void endstone::Logger::debug (
    const std::string & message
) const

function debug [2/2]

template<typename... Args>
inline void endstone::Logger::debug (
    const fmt::format_string< Args... > format,
    Args &&... args
) const

function error [⅓]

inline void endstone::Logger::error (
    const std::string & message
) const

function error [⅔]

template<typename... Args>
inline void endstone::Logger::error (
    const fmt::format_string< Args... > format,
    Args &&... args
) const

function error [3/3]

inline void endstone::Logger::error (
    const endstone::Error & error
) const

function getName

Get the name of this Logger instance.

virtual std::string_view endstone::Logger::getName () const = 0

Returns:

The name of this Logger instance.


function info [½]

inline void endstone::Logger::info (
    const std::string & message
) const

function info [2/2]

template<typename... Args>
inline void endstone::Logger::info (
    const fmt::format_string< Args... > format,
    Args &&... args
) const

function isEnabledFor

Check if the Logger instance is enabled for the given logLevel .

virtual bool endstone::Logger::isEnabledFor (
    Level level
) const = 0

Parameters:

  • level The log level to check

Returns:

true if the logger is enabled for the Level, false otherwise.


function log [½]

Log a message at the given level.

virtual void endstone::Logger::log (
    Level level,
    const std::string & message
) const = 0

Parameters:

  • level The level at which the message should be logged.
  • message The message to log.

function log [2/2]

template<typename... Args>
inline void endstone::Logger::log (
    Level level,
    const fmt::format_string< Args... > format,
    Args &&... args
) const

function setLevel

Set the logging level for this Logger instance.

virtual void endstone::Logger::setLevel (
    Level level
) = 0

Parameters:

  • level The desired log level

function trace [½]

inline void endstone::Logger::trace (
    const std::string & message
) const

function trace [2/2]

template<typename... Args>
inline void endstone::Logger::trace (
    const fmt::format_string< Args... > format,
    Args &&... args
) const

function warning [½]

inline void endstone::Logger::warning (
    const std::string & message
) const

function warning [2/2]

template<typename... Args>
inline void endstone::Logger::warning (
    const fmt::format_string< Args... > format,
    Args &&... args
) const

function ~Logger

virtual endstone::Logger::~Logger () = default


The documentation for this class was generated from the following file include/endstone/logger.h