$darkmode
#include <functional>#include <memory>#include <string>#include <fable/enum.hpp>#include <spdlog/spdlog.h>Go to the source code of this file.
Functions | |
| FABLE_ENUM_SERIALIZATION (spdlog::level::level_enum,({ {spdlog::level::level_enum::trace, "trace"}, {spdlog::level::level_enum::debug, "debug"}, {spdlog::level::level_enum::info, "info"}, {spdlog::level::level_enum::warn, "warning"}, {spdlog::level::level_enum::err, "error"}, {spdlog::level::level_enum::critical, "fatal"}, {spdlog::level::level_enum::off, "off"}, })) namespace cloe | |
This file provides method for retrieving loggers for different namespaces within the cloe library.
The typical use-case of the functions in this file look like this:
| FABLE_ENUM_SERIALIZATION | ( | spdlog::level::level_enum | , |
| ({ {spdlog::level::level_enum::trace, "trace"}, {spdlog::level::level_enum::debug, "debug"}, {spdlog::level::level_enum::info, "info"}, {spdlog::level::level_enum::warn, "warning"}, {spdlog::level::level_enum::err, "error"}, {spdlog::level::level_enum::critical, "fatal"}, {spdlog::level::level_enum::off, "off"},}) | |||
| ) |
Logger is a shared_ptr to an spdlog::logger.
By default, this prints log messages to the console like so:
2017-04-20 08:37:03.787] [NAME] [LEVEL] MESSAGE
where NAME is the name of the logger, LEVEL is the logging level, and MESSAGE is the message to be printed.
Levels available are:
Each of these levels can be used via a method of the same name. For example:
Formatting available for these functions is via the fmt library, see http://fmtlib.net for an overview of the formatting supported.
For a more detailed look at what the logger provides, see <spdlog/logger.h>. Alternatively, the Github site has more documentation.
LogLevel represents the various severity levels of messages. See Logger for more details on the levels.
The individual levels can be accessed through spdlog::level. For example,
Return a logger for the given namespace name.
If the logger does not exist, a new one will be created with the logger factory. See the documentation on the Logger type for information on how to use it.
Sets the logger factory for loggers that do not exist yet.
The default implementation uses an spdlog::stdout_logger_mt. You can pass this function a lambda where you can use whatever logic you like. If this function registers a logger with a name, then this function will not be called again when getting that name, otherwise it will. That makes voodoo like the following possible:
You can pass in any function, function object, lambda, etc.
Set the acceptable level of output for all loggers.
This can be overridden on a per-logger basis. For example:
Convert the strings trace, debug, info, warn|warning, err|error, critical|fatal, and off|disable into a logging level.
Convert a logging level to one of the strings trace, debug, info, warn, err, critical, and off.