class
#include <include/okapi/api/util/logging.hpp>
Logger
Contents
Public types
Public static functions
- static auto getDefaultLogger() -> std::shared_ptr<Logger>
- static void setDefaultLogger(std::shared_ptr<Logger> ilogger)
- Sets a new default logger.
Constructors, destructors, conversion operators
- Logger() noexcept
- A logger that does nothing.
- Logger(std::unique_ptr<AbstractTimer> itimer, std::string_view ifileName, const LogLevel& ilevel) noexcept
- A logger that opens the input file by name.
- Logger(std::unique_ptr<AbstractTimer> itimer, FILE* ifile, const LogLevel& ilevel) noexcept
- A logger that uses an existing file handle.
- ~Logger()
Public functions
- auto isDebugLevelEnabled() const -> bool constexpr noexcept
-
template<typename T>void debug(T ilazyMessage) noexcept
- auto isInfoLevelEnabled() const -> bool constexpr noexcept
-
template<typename T>void info(T ilazyMessage) noexcept
- auto isWarnLevelEnabled() const -> bool constexpr noexcept
-
template<typename T>void warn(T ilazyMessage) noexcept
- auto isErrorLevelEnabled() const -> bool constexpr noexcept
-
template<typename T>void error(T ilazyMessage) noexcept
- void close() constexpr noexcept
- Closes the connection to the log file.
Enum documentation
Function documentation
static std::shared_ptr<Logger> okapi:: Logger:: getDefaultLogger()
Returns | The default logger. |
---|
static void okapi:: Logger:: setDefaultLogger(std::shared_ptr<Logger> ilogger)
Sets a new default logger.
Parameters | |
---|---|
ilogger | The new logger instance. |
OkapiLib classes use the default logger unless given another logger in their constructor.
okapi:: Logger:: Logger(std::unique_ptr<AbstractTimer> itimer,
std::string_view ifileName,
const LogLevel& ilevel) noexcept
A logger that opens the input file by name.
Parameters | |
---|---|
itimer | A timer used to get the current time for log statements. |
ifileName | The name of the log file to open. |
ilevel | The log level. Log statements more verbose than this level will be disabled. |
If the file contains /ser/
, the file will be opened in write mode. Otherwise, the file will be opened in append mode. The file will be closed when the logger is destructed.
okapi:: Logger:: Logger(std::unique_ptr<AbstractTimer> itimer,
FILE* ifile,
const LogLevel& ilevel) noexcept
A logger that uses an existing file handle.
Parameters | |
---|---|
itimer | A timer used to get the current time for log statements. |
ifile | The log file to open. Will be closed by the logger! |
ilevel | The log level. Log statements more verbose than this level will be disabled. |
The file will be closed when the logger is destructed.