Using Banjo's logging system with severity levels and filtering.
Using Banjo's logging system with severity levels and filtering.Banjo provides a multi-level logging system for debugging and diagnostics. Messages can be filtered by severity, formatted like printf, and queried for output length.
int main(int argc, char* argv[]) {
(void)argc;
(void)argv;
bj_info(
"Default log level: %d\n", default_level);
bj_err(
"This is an error message");
size_t written =
bj_warn(
"Room #%d is closed, but you have '%s'", 42,
"The Key Item");
bj_info(
"Previous log message was written in %ld characters (excluding '\\0')", written);
return 0;
}
Assertion facility for Banjo API.
#define bj_assert(expr)
Runtime assertion macro.
Definition assert.h:34
int bj_get_log_level(void)
Gets the current log level set by bj_set_log_level.
#define bj_info(...)
Log a message using the BJ_LOG_INFO level.
Definition log.h:105
#define bj_warn(...)
Log a message using the BJ_LOG_WARN level.
Definition log.h:119
#define bj_err(...)
Log a message using the BJ_LOG_ERROR level.
Definition log.h:133
void bj_set_log_level(int level)
Sets the default log level.
#define bj_log_msg(LEVEL,...)
Log a message using the given level LEVEL.
Definition log.h:60
@ BJ_LOG_INFO
Informational messages about execution.
Definition log.h:33
Logging utility functions.
Portable main substitution and application callback facilities.