- Info
1
6
7
13
14 #ifndef _INCLUDE__BASE__PRINTF_H_
15 #define _INCLUDE__BASE__PRINTF_H_
16
17 #include <stdarg.h>
18
19 namespace Genode {
20
21
24 void printf(const char *format, ...);
25 void vprintf(const char *format, va_list);
26
27
28 extern "C" void format_check(const char *format, ...) __attribute__((format(printf, 1, 2)));
29 }
30
31 #define ESC_DBG "\033[33m"
32 #define ESC_WRN "\033[34m"
33 #define ESC_ERR "\033[31m"
34 #define ESC_END "\033[0m"
35
36
48
49 #define PDBG(fmt, ...) \
50 do { \
51 if (0) Genode::format_check(fmt, ##__VA_ARGS__); \
52 Genode::printf("%s: " ESC_DBG fmt ESC_END "\n", \
53 __PRETTY_FUNCTION__, ##__VA_ARGS__ ); \
54 } while (0)
55
56 #define PWRN(fmt, ...) \
57 do { \
58 if (0) Genode::format_check(fmt, ##__VA_ARGS__); \
59 Genode::printf("%s: " ESC_WRN fmt ESC_END "\n", \
60 __PRETTY_FUNCTION__, ##__VA_ARGS__ ); \
61 } while (0)
62
63 #define PERR(fmt, ...) \
64 do { \
65 if (0) Genode::format_check(fmt, ##__VA_ARGS__); \
66 Genode::printf("%s: " ESC_ERR fmt ESC_END "\n", \
67 __PRETTY_FUNCTION__, ##__VA_ARGS__ ); \
68 } while (0)
69
70 #endif