Skip to Content
⚠ Under Construction
ReferenceC++ APILogger

endstone::Logger

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

Types:

NameDescription
LevelSpecifies the log level.

Functions:

NameDescription
Logger
critical
critical
debug
debug
error
error
getNameGet the name of this Logger instance.
info
info
isEnabledForCheck if the Logger instance is enabled for the given log Level .
logLog a message at the given level.
log
setLevelSet the logging level for this Logger instance.
trace
trace
warning
warning

Level

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

Specifies the log level.

Logger

Logger() = default

critical

void critical(const std::string_view message) const
template <typename... Args, std::enable_if_t<(sizeof...(Args) > 0), int>> void critical(const fmt::format_string<Args...> format, Args &&...args) const

debug

void debug(const std::string_view message) const
template <typename... Args, std::enable_if_t<(sizeof...(Args) > 0), int>> void debug(const fmt::format_string<Args...> format, Args &&...args) const

error

void error(const std::string_view message) const
template <typename... Args, std::enable_if_t<(sizeof...(Args) > 0), int>> void error(const fmt::format_string<Args...> format, Args &&...args) const

getName

std::string_view getName() const

Get the name of this Logger instance.

Returns:

The name of this Logger instance.

info

void info(const std::string_view message) const
template <typename... Args, std::enable_if_t<(sizeof...(Args) > 0), int>> void info(const fmt::format_string<Args...> format, Args &&...args) const

isEnabledFor

bool isEnabledFor(Level level) const

Check if the Logger instance is enabled for the given log Level .

Parameters:

  • level The log level to check

Returns:

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

log

void log(Level level, std::string_view message) const

Log a message at the given level.

Parameters:

  • level The level at which the message should be logged.
  • message The message to log.
template <typename... Args, std::enable_if_t<(sizeof...(Args) > 0), int>> void log(Level level, const fmt::format_string<Args...> format, Args &&...args) const

setLevel

void setLevel(Level level)

Set the logging level for this Logger instance.

Parameters:

  • level The desired log level

trace

void trace(const std::string_view message) const
template <typename... Args, std::enable_if_t<(sizeof...(Args) > 0), int>> void trace(const fmt::format_string<Args...> format, Args &&...args) const

warning

void warning(const std::string_view message) const
template <typename... Args, std::enable_if_t<(sizeof...(Args) > 0), int>> void warning(const fmt::format_string<Args...> format, Args &&...args) const
Last updated on