1 #ifndef __LUNAIX_SYSLOG_H
2 #define __LUNAIX_SYSLOG_H
4 #include <lunaix/compiler.h>
13 #define KMSG_LVLSTART '\x1b'
14 #define KMSG_LOGLEVEL(c) ((c) - '0')
16 #define KDEBUG "\x1b" stringify__(KLOG_DEBUG)
17 #define KINFO "\x1b" stringify__(KLOG_INFO)
18 #define KWARN "\x1b" stringify__(KLOG_WARN)
19 #define KERROR "\x1b" stringify__(KLOG_ERROR)
20 #define KFATAL "\x1b" stringify__(KLOG_FATAL)
22 #define LOG_MODULE(module) \
23 static void kprintf(const char* fmt, ...) \
26 va_start(args, fmt); \
27 kprintf_m(module, fmt, args); \
31 #define DEBUG(fmt, ...) kprintf(KDEBUG fmt, ##__VA_ARGS__)
32 #define INFO(fmt, ...) kprintf(KINFO fmt, ##__VA_ARGS__)
33 #define WARN(fmt, ...) kprintf(KWARN fmt, ##__VA_ARGS__)
34 #define ERROR(fmt, ...) kprintf(KERROR fmt, ##__VA_ARGS__)
35 #define FATAL(fmt, ...) \
37 kprintf(KFATAL fmt, ##__VA_ARGS__); \
42 kprintf_m(const char* component, const char* fmt, va_list args);
44 // TODO need more thought on it
54 // kprintf_lcstart_m(const char* component, size_t size);
57 // kprintf_lcappend_m(struct klog_chunk*, const char* fmt, va_list args);
60 // kprintf_lcdone_m(struct klog_chunk*);
62 #endif /* __LUNAIX_SYSLOG_H */