summaryrefslogtreecommitdiff
path: root/include/al/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/al/log.h')
-rw-r--r--include/al/log.h9
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__)