diff options
| author | 2026-07-27 11:29:01 -0400 | |
|---|---|---|
| committer | 2026-07-27 11:29:01 -0400 | |
| commit | 654d8eca70eef868455a08ab749e21b934a4f845 (patch) | |
| tree | b185ce1fb7a0a0ffc054455f02bdb6cdd0fbb428 /include/al/log.h | |
| parent | 7e9e479502e6d56057aac066b61336d0013b6a7a (diff) | |
| download | libalabaster-654d8eca70eef868455a08ab749e21b934a4f845.tar.gz libalabaster-654d8eca70eef868455a08ab749e21b934a4f845.tar.bz2 libalabaster-654d8eca70eef868455a08ab749e21b934a4f845.zip | |
log: Add path for when log has no args
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'include/al/log.h')
| -rw-r--r-- | include/al/log.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/al/log.h b/include/al/log.h index 7fd72dd..92e6e29 100644 --- a/include/al/log.h +++ b/include/al/log.h @@ -17,6 +17,7 @@ AL_IGNORE_WARNING_END #define __LOCATION__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__ #define AL_LOG_MESSAGE_SIZE 256u +#define AL_LOG_MESSAGE_LENGTH (AL_LOG_MESSAGE_SIZE - 1u) enum { AL_LOG_INFO = 0, @@ -28,11 +29,11 @@ enum { void al_set_print(s32 (*print_func)(void *, u8, char *), void *userdata); -s32 _al_log(u8 level, const char *section, const char *name, const s32 line, const char *func, const char *fmt, ...); -s32 _al_logv(u8 level, const char *section, const char *name, const s32 line, const char *func, const char *fmt, va_list args); +s32 _al_log(u8 level, const char *section, const char *name, const s32 line, const char *func, bool no_args, const char *fmt, ...); +s32 _al_logv(u8 level, const char *section, const char *name, const s32 line, const char *func, bool no_args, const char *fmt, va_list args); -#define al_log(level, section, fmt, ...) _al_log(level, section, __LOCATION__, fmt, ##__VA_ARGS__) -#define al_logv(level, section, fmt, args) _al_logv(level, section, __LOCATION__, fmt, args) +#define al_log(level, section, fmt, ...) _al_log(level, section, __LOCATION__, (sizeof((char[]){#__VA_ARGS__}) == 1), fmt, ##__VA_ARGS__) +#define al_logv(level, section, fmt, args) _al_logv(level, section, __LOCATION__, false, fmt, args) #define log_info(fmt, ...) al_log(AL_LOG_INFO, AL_LOG_SECTION_NAME, fmt, ##__VA_ARGS__) #define log_warn(fmt, ...) al_log(AL_LOG_WARN, AL_LOG_SECTION_NAME, fmt, ##__VA_ARGS__) |