class final
#include <core/tel/logging.hpp>
Logger Singleton which holds the logging state.
Public types
Public static functions
- static void level(Level level)
- Sets the log level.
- static auto level() -> Level
- Gets the current log level.
- static auto logToFile(const std::string& filePath) -> bool
- Sets a file path where logs will be saved.
- static auto logToFile() -> bool
- Mounts a standard archive on the
/logs/
directory, and callslogToFile
to a timestamped log file on that directory. - static void write(Level level, Location location, std::string message)
- Creates a new entry in the logs, as long as the log level is high enough.
-
template<typename... TArgs>static void writeFormat(Level level, Location location, const char* format, TArgs... args)
- Wrapper for write() with message formatting.
- static auto read(std::size_t& cursor, Entry& entry) -> bool
- Reads a log entry, if there's a new one.
Constructors, destructors, conversion operators
- Logger() deleted
- Deleted constructor.
Function documentation
static void cubos:: core:: tel:: Logger:: level(Level level)
Sets the log level.
Parameters | |
---|---|
level | New logging level. |
If CUBOS_
static bool cubos:: core:: tel:: Logger:: logToFile(const std::string& filePath)
Sets a file path where logs will be saved.
Parameters | |
---|---|
filePath | Path to file in the virtual file system. |
Returns | Whether the file could be opened for logging. |
static bool cubos:: core:: tel:: Logger:: logToFile()
Mounts a standard archive on the /logs/
directory, and calls logToFile
to a timestamped log file on that directory.
Returns | Whether the file could be mounted and opened for logging. |
---|
template<typename... TArgs>
static void cubos:: core:: tel:: Logger:: writeFormat(Level level,
Location location,
const char* format,
TArgs... args)
Wrapper for write() with message formatting.
Template parameters | |
---|---|
TArgs | Message format argument types. |
Parameters | |
level | Log level. |
location | Code location. |
format | Message format string. |
args | Message format arguments. |