add bug logging fn
This commit is contained in:
parent
64a7a67f00
commit
94617351ed
2 changed files with 10 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
||||||
#define __DEBUG 1
|
#define __DEBUG 1
|
||||||
#define __WARNING 2
|
#define __WARNING 2
|
||||||
#define __ERROR 3
|
#define __ERROR 3
|
||||||
|
#define __BUG 4
|
||||||
|
|
||||||
__attribute__((format(printf, 4, 5)))
|
__attribute__((format(printf, 4, 5)))
|
||||||
void __log_impl_pos(int line, int column, int type, const char *format, ...);
|
void __log_impl_pos(int line, int column, int type, const char *format, ...);
|
||||||
|
@ -25,6 +26,9 @@ void __log_impl(int type, const char *format, ...);
|
||||||
#define WARNING(format, ...) \
|
#define WARNING(format, ...) \
|
||||||
__log_impl(__WARNING, format, ##__VA_ARGS__)
|
__log_impl(__WARNING, format, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#define BUG(format, ...) \
|
||||||
|
__log_impl(__BUG, format, ##__VA_ARGS__)
|
||||||
|
|
||||||
#define ERROR(format, ...) \
|
#define ERROR(format, ...) \
|
||||||
__log_impl(__ERROR, format, ##__VA_ARGS__)
|
__log_impl(__ERROR, format, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,9 @@ void __log_impl_pos(int line, int column, int type, const char *format, ...)
|
||||||
case __ERROR:
|
case __ERROR:
|
||||||
t = "\033[31merror:\033[0m";
|
t = "\033[31merror:\033[0m";
|
||||||
break;
|
break;
|
||||||
|
case __BUG:
|
||||||
|
t = "\033[31bug:\033[0m";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_file != NULL)
|
if (current_file != NULL)
|
||||||
|
@ -55,6 +58,9 @@ void __log_impl(int type, const char *format, ...)
|
||||||
case __ERROR:
|
case __ERROR:
|
||||||
t = "\033[31merror:\033[0m";
|
t = "\033[31merror:\033[0m";
|
||||||
break;
|
break;
|
||||||
|
case __BUG:
|
||||||
|
t = "\033[31bug:\033[0m";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_file != NULL)
|
if (current_file != NULL)
|
||||||
|
|
Loading…
Reference in a new issue