Logging¶
Log Levels¶
OFF: No logs at all
ERROR: Serious error
WARN: Warning about something wrong
INFO: Helpful ideally short and infrequent, message about system status
DEBUG: Message for debugging reasons only
DEBUG2: Super detailed debugging messages
Note both DEBUG and DEBUG2 are removed entirely when building in release mode.
FATAL_ERROR: Like ERROR but also exits kotekan returning an error code
In classes inheriting from kotekan::kotekanLogging¶
Logging macros are defined in lib/core/kotekanLogging.cpp. Use DEBUG2, DEBUG, INFO,
WARN and ERROR from any class inheriting from kotekan::kotekanLogging.
Use fmt format string syntax.
The log level for objects inheriting from kotekan::kotekanLogging can be adjusted on a per-object basis. So it is possible to have different objects operating at different log levels based on the configuration.
Non-object oriented logging¶
If you need logging in a static method or outside of kotekan::kotekanLogging, you can use DEBUG2_NON_OO, DEBUG_NON_OO, INFO_NON_OO, WARN_NON_OO and ERROR_NON_OO. Use fmt format string syntax. These will use the default log level set in the configuration.
Format String Checks¶
The fmt format strings are checked on compile-time if your compiler has sufficient constexpr support (e.g. g++ 6.1).
C logging¶
If you need logging in C code, use the macros DEBUG2_F, DEBUG_F, INFO_F, WARN_F and
ERROR_F defined in lib/core/errors.h.
Use printf format string
syntax.
These should not be used within the C++ code and may be depreciated when the remaining C code is removed from the system.
They use the default log level set in the configuration.