modm API documentation
|
Namespaces | |
modm::log | |
Logger. | |
Classes | |
class | modm::log::DefaultStyle |
This is an empty style More... | |
class | modm::log::Logger |
Interface to the Logger More... | |
class | modm::log::Prefix< T, STYLE > |
Add a prefix to the log message More... | |
class | modm::log::StdColour< TEXT, BACKGROUND, STYLE > |
This style colours the given stream in the color given by the template argument More... | |
class | modm::log::Style< STYLE > |
This is the interface to all style-classes of the logger More... | |
class | modm::log::StyleWrapper< STYLE > |
Wrapper to use the Style as a IODevice in the Logger More... | |
Macros | |
#define | MODM_LOG_LEVEL modm::log::DEBUG |
Default log level. More... | |
#define | MODM_LOG_OFF |
Turn off messages print. More... | |
#define | MODM_LOG_DEBUG |
Output stream for debug messages. More... | |
#define | MODM_LOG_INFO |
Output stream for info messages. More... | |
#define | MODM_LOG_WARNING |
Output stream for warnings. More... | |
#define | MODM_LOG_ERROR |
Output stream for error messages. More... | |
#define | FILENAME |
Filename of the current file. More... | |
#define | MODM_FILE_INFO |
String containing the filename and the current line. More... | |
Enums | |
enum | modm::log::Level { DEBUG, INFO, WARNING, ERROR, DISABLED } |
Log levels. More... | |
lbuild module: modm:debug
The modm::log::Logger
uses a modm::IOStream
to read messages and write them to a given output device.
Write a log message with streams:
The name of the stream represents the log level of the message. Available are:
A log message can also be generated separately:
This is to give an estimation how many resources a call of the logger use. All considerations are for a PC program.
The given call is:
The macro resolves to:
modm::log::debug
is an instance of modm::Logger
: Call of modm::Logger::operator << (T)
(with T = int32_t
) which is inlineIOStream::operator \<\< (T)
(with T = int32_t
) is inlineIOStream::writeInteger(int32_t)
IOStream::writeInteger(int32_t)
will create the formatted stringIODevice::write(const char*)
std::cout
In sum there are two nested method calls with one of them being virtual.
#define FILENAME |
Filename of the current file.
In contrast to FILE
the path to the file is omitted (if this feature is available, otherwise this macro will resolve to FILE
).
#define MODM_FILE_INFO |
String containing the filename and the current line.
Will generate something like:
This can be very useful the track the origin of log-messages:
This will result into:
#define MODM_LOG_DEBUG |
Output stream for debug messages.
#define MODM_LOG_ERROR |
Output stream for error messages.
#define MODM_LOG_INFO |
Output stream for info messages.
#define MODM_LOG_LEVEL modm::log::DEBUG |
Default log level.
Define to set the level of the logging to a defined value for each file. To change the logging level in a source file use #undef
DEBUG < INFO < WARNING < ERROR < DISABLED
#define MODM_LOG_OFF |
Turn off messages print.
#define MODM_LOG_WARNING |
Output stream for warnings.
enum modm::log::Level |
Log levels.
DEBUG < INFO < WARNING < ERROR < DISABLED