Banjo API 1.1.0-alpha
Low-level C99 game development API
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1
5
47#ifndef BJ_LOG_H
48#define BJ_LOG_H
49
50#include <banjo/api.h>
51
59#define BJ_MAXIMUM_LOG_LEN 120u
60
73#ifndef BJ_NO_TYPEDEF
75#endif
76
95#ifdef BJ_BUILD_RELEASE
96# define bj_log_msg(LEVEL, ...) bj_log_message(BJ_LOG_ ## LEVEL, 0, 0, __VA_ARGS__)
97#else
98# define bj_log_msg(LEVEL, ...) bj_log_message(BJ_LOG_ ## LEVEL, __FILE__, __LINE__, __VA_ARGS__)
99#endif
100
113#define bj_trace(...) bj_log_msg(TRACE, __VA_ARGS__)
114
127#define bj_debug(...) bj_log_msg(DEBUG, __VA_ARGS__)
128
141#define bj_info(...) bj_log_msg(INFO, __VA_ARGS__)
142
155#define bj_warn(...) bj_log_msg(WARN, __VA_ARGS__)
156
169#define bj_err(...) bj_log_msg(ERROR, __VA_ARGS__)
170
183#define bj_fatal(...) bj_log_msg(FATAL, __VA_ARGS__)
184
194BANJO_EXPORT const char* bj_log_level_name(int level);
195
198
209
215
266BANJO_EXPORT size_t bj_log_message(int level, const char* file, int line, const char* format, ...);
267
268#endif
General-purpose definitions for Banjo API.
#define BANJO_EXPORT
Definition api.h:179
int bj_get_log_level(void)
Gets the current log level set by bj_set_log_level.
const char * bj_get_log_level_string(int level)
size_t bj_log_message(int level, const char *file, int line, const char *format,...)
Generic message reporting function.
void bj_set_log_level(int level)
Sets the default log level.
bj_log_level
Log Levels.
Definition log.h:65
const char * bj_log_level_name(int level)
Return the name of the given log level ("TRACE", "WARN", ...).
@ BJ_LOG_INFO
Informational messages about execution.
Definition log.h:68
@ BJ_LOG_TRACE
Fine-grained diagnostic details.
Definition log.h:66
@ BJ_LOG_WARN
Warnings for potential issues.
Definition log.h:69
@ BJ_LOG_FATAL
Critical errors leading to termination.
Definition log.h:71
@ BJ_LOG_ERROR
Errors preventing correct function.
Definition log.h:70
@ BJ_LOG_DEBUG
Detailed information for debugging.
Definition log.h:67