Embedded Multicore Building Blocks V1.0.0
|
Simple logging facilities. More...
Typedefs | |
typedef void(* | embb_log_function_t) (void *context, char const *message) |
Logging function type. More... | |
Enumerations | |
enum | embb_log_level_t { EMBB_LOG_LEVEL_NONE, EMBB_LOG_LEVEL_ERROR, EMBB_LOG_LEVEL_WARNING, EMBB_LOG_LEVEL_INFO, EMBB_LOG_LEVEL_TRACE } |
Log levels available for filtering the log. More... | |
Functions | |
void | embb_log_write_file (void *context, char const *message) |
Default logging function. More... | |
void | embb_log_set_log_level (embb_log_level_t log_level) |
Sets the global log level. More... | |
void | embb_log_set_log_function (void *context, embb_log_function_t func) |
Sets the global logging function. More... | |
void | embb_log_write (char const *channel, embb_log_level_t log_level, char const *message,...) |
Logs a message to the given channel with the specified log level. More... | |
void | embb_log_trace (char const *channel, char const *message,...) |
Logs a message to the given channel with EMBB_LOG_LEVEL_TRACE using embb_log_write(). More... | |
void | embb_log_info (char const *channel, char const *message,...) |
Logs a message to the given channel with EMBB_LOG_LEVEL_INFO using embb_log_write(). More... | |
void | embb_log_warning (char const *channel, char const *message,...) |
Logs a message to the given channel with EMBB_LOG_LEVEL_WARNING using embb_log_write(). More... | |
void | embb_log_error (char const *channel, char const *message,...) |
Logs a message to the given channel with EMBB_LOG_LEVEL_ERROR using embb_log_write(). More... | |
Simple logging facilities.
typedef void(* embb_log_function_t) (void *context, char const *message) |
Logging function type.
This function is used by embb_log_write() to transfer a log message to its desired destination. The user may specify a pointer to a context that contains additional data (filter rules, file handles etc.) needed to put the message where it should go. This pointer might be NULL if no additional data is needed.
enum embb_log_level_t |
void embb_log_write_file | ( | void * | context, |
char const * | message | ||
) |
Default logging function.
Writes to the given file (context needs to be a FILE*).
context
is not NULL.[in] | context | User data, in this case a FILE* file handle. |
[in] | message | The message to write |
void embb_log_set_log_level | ( | embb_log_level_t | log_level | ) |
Sets the global log level.
This determines what messages will be shown, messages with a more detailed log level will be filtered out. The default log level is EMBB_LOG_LEVEL_NONE.
[in] | log_level | Log level to use for filtering |
void embb_log_set_log_function | ( | void * | context, |
embb_log_function_t | func | ||
) |
Sets the global logging function.
The logging function implements the mechanism for transferring log messages to their destination. context
is a pointer to data the user needs in the function to determine where the messages should go (may be NULL if no additional data is needed). The default logging function is embb_log_write_file() with context set to stdout
.
[in] | context | User context to supply as the first parameter of the logging function |
[in] | func | The logging function |
void embb_log_write | ( | char const * | channel, |
embb_log_level_t | log_level, | ||
char const * | message, | ||
... | |||
) |
Logs a message to the given channel with the specified log level.
If the log level is greater than the configured log level for the channel, the message will be ignored.
[in] | channel | User specified channel id for filtering the log later on. Might be NULL, channel identifier will be "global" in that case |
[in] | log_level | Log level to use |
[in] | message | Message to convey, may use printf style formatting |
void embb_log_trace | ( | char const * | channel, |
char const * | message, | ||
... | |||
) |
Logs a message to the given channel with EMBB_LOG_LEVEL_TRACE using embb_log_write().
In non-debug builds, this function does nothing.
[in] | channel | User specified channel id |
[in] | message | Message to convey, may use printf style formatting |
void embb_log_info | ( | char const * | channel, |
char const * | message, | ||
... | |||
) |
Logs a message to the given channel with EMBB_LOG_LEVEL_INFO using embb_log_write().
In non-debug builds, this function does nothing.
[in] | channel | User specified channel id |
[in] | message | Message to convey, may use printf style formatting |
void embb_log_warning | ( | char const * | channel, |
char const * | message, | ||
... | |||
) |
Logs a message to the given channel with EMBB_LOG_LEVEL_WARNING using embb_log_write().
[in] | channel | User specified channel id |
[in] | message | Message to convey, may use printf style formatting |
void embb_log_error | ( | char const * | channel, |
char const * | message, | ||
... | |||
) |
Logs a message to the given channel with EMBB_LOG_LEVEL_ERROR using embb_log_write().
[in] | channel | User specified channel id |
[in] | message | Message to convey, may use printf style formatting |