Fixposition SDK 0.0.0-heads/main-0-g90a51ff
Collection of c++ libraries and apps for use with Fixposition products
|
Logging. More...
Classes | |
struct | LoggingParams |
Logging parameters. More... | |
Typedefs | |
using | LoggingPrintFunc = void (*)(const LoggingParams&, const LoggingLevel, const char*) |
Custom logging print function signature. | |
Enumerations | |
enum class | LoggingLevel : int { FATAL = 2 , ERROR = 3 , WARNING = 4 , NOTICE = 5 , INFO = 6 , DEBUG = 7 , TRACE = 8 } |
Logging verbosity levels, default is INFO. More... | |
enum class | LoggingColour { AUTO = 0 , YES , NO , JOURNAL } |
Logging "colours". More... | |
enum class | LoggingTimestamps { NONE = 0 , RELATIVE , ABSOLUTE } |
Logging timestamps. More... | |
Functions | |
LoggingLevel & | operator++ (LoggingLevel &level) |
Increase verbosity (pre-increment) | |
LoggingLevel & | operator-- (LoggingLevel &level) |
Decrease verbosity (pre-decrement) | |
LoggingLevel | operator++ (LoggingLevel &level, int) |
Increase verbosity (post-increment) | |
LoggingLevel | operator-- (LoggingLevel &level, int) |
Decrease verbosity (post-decrement) | |
const char * | LoggingLevelStr (const LoggingLevel level) |
Stringify log level. | |
bool | LoggingIsLevel (const LoggingLevel level) |
Check if given level would print. | |
const char * | LoggingColourStr (const LoggingColour colour) |
Stringify log level. | |
const char * | LoggingTimestampsStr (const LoggingTimestamps timestamps) |
Stringify log level. | |
LoggingParams | LoggingSetParams (const LoggingParams ¶ms) |
Configure logging. | |
LoggingParams | LoggingGetParams () |
Get current logging params. | |
void | LoggingPrint (const LoggingLevel level, const char *fmt,...) PRINTF_ATTR(2) |
Print a log message. | |
void | LoggingHexdump (const LoggingLevel level, const uint8_t *data, const std::size_t size, const char *prefix, const char *fmt,...) PRINTF_ATTR(5) |
Print a hexdump. | |
Logging.
using fpsdk::common::logging::LoggingPrintFunc = void (*)(const LoggingParams&, const LoggingLevel, const char*) |
Custom logging print function signature.
Definition at line 255 of file logging.hpp.
|
strong |
Logging verbosity levels, default is INFO.
The logging levels loosely follow syslog levels (indicated in [] below, see also https://en.wikipedia.org/wiki/Syslog)
Libraries (fpsdk_common, fpsdk_ros1, ...) code shall only use WARNING and DEBUG.
Definition at line 177 of file logging.hpp.
|
strong |
Logging "colours".
Definition at line 214 of file logging.hpp.
|
strong |
Logging timestamps.
Enumerator | |
---|---|
NONE | No timestamps. |
RELATIVE | Relative timestamps (since first logging message, sssss.sss format) |
ABSOLUTE | Absolute timestamps (local time, yyyy-mm-dd hh::mm:ss.sss format) |
Definition at line 234 of file logging.hpp.
const char * fpsdk::common::logging::LoggingLevelStr | ( | const LoggingLevel | level | ) |
Stringify log level.
[in] | level | The logging level |
bool fpsdk::common::logging::LoggingIsLevel | ( | const LoggingLevel | level | ) |
Check if given level would print.
[in] | level | The logging level in question |
const char * fpsdk::common::logging::LoggingColourStr | ( | const LoggingColour | colour | ) |
Stringify log level.
[in] | colour | The logging colour |
const char * fpsdk::common::logging::LoggingTimestampsStr | ( | const LoggingTimestamps | timestamps | ) |
Stringify log level.
[in] | timestamps | The logging timestamps |
LoggingParams fpsdk::common::logging::LoggingSetParams | ( | const LoggingParams & | params | ) |
Configure logging.
[in] | params | Logging parameters |
Examples:
LoggingParams fpsdk::common::logging::LoggingGetParams | ( | ) |
Get current logging params.
void fpsdk::common::logging::LoggingPrint | ( | const LoggingLevel | level, |
const char * | fmt, | ||
... ) |
void fpsdk::common::logging::LoggingHexdump | ( | const LoggingLevel | level, |
const uint8_t * | data, | ||
const std::size_t | size, | ||
const char * | prefix, | ||
const char * | fmt, | ||
... ) |
Print a hexdump.
[in] | level | Logging level |
[in] | data | Pointer to start of data to dump |
[in] | size | Size of data to dump |
[in] | prefix | Prefix to add to each line, can be NULL to omit |
[in] | fmt | printf() style format string (for a first line to print), can be NULL to omit |
[in] | ... | Arguments to the format string |