1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-10-30 12:03:52 -04:00

Add debug log level

This commit is contained in:
Braiden Vasco 2017-11-06 04:30:25 +00:00
parent eca3f947eb
commit 68ca2b7b3a
2 changed files with 11 additions and 7 deletions

View file

@ -4,15 +4,17 @@
#include <kernelmq/stdlib.h>
#define LEVELS_COUNT 3
#define LEVELS_COUNT 4
static const enum vga_color level_colors[LEVELS_COUNT] = {
VGA_COLOR_DARK_GREY,
VGA_COLOR_CYAN,
VGA_COLOR_MAGENTA,
VGA_COLOR_RED,
};
static const char *const level_text[LEVELS_COUNT] = {
"DBUG",
"INFO",
"WARN",
"FAIL",

View file

@ -1,13 +1,15 @@
#ifndef KERNELMQ_INCLUDED_LOGGER
#define KERNELMQ_INCLUDED_LOGGER 1
#define logger_info_from(source, ...) logger_log(0, source, __VA_ARGS__)
#define logger_warn_from(source, ...) logger_log(1, source, __VA_ARGS__)
#define logger_fail_from(source, ...) logger_log(2, source, __VA_ARGS__)
#define logger_debug_from(source, ...) logger_log(0, source, __VA_ARGS__)
#define logger_info_from(source, ...) logger_log(1, source, __VA_ARGS__)
#define logger_warn_from(source, ...) logger_log(2, source, __VA_ARGS__)
#define logger_fail_from(source, ...) logger_log(3, source, __VA_ARGS__)
#define logger_info(...) logger_info_from(0, __VA_ARGS__)
#define logger_warn(...) logger_warn_from(0, __VA_ARGS__)
#define logger_fail(...) logger_fail_from(0, __VA_ARGS__)
#define logger_debug(...) logger_debug_from(0, __VA_ARGS__)
#define logger_info(...) logger_info_from(0, __VA_ARGS__)
#define logger_warn(...) logger_warn_from(0, __VA_ARGS__)
#define logger_fail(...) logger_fail_from(0, __VA_ARGS__)
void logger_log(unsigned char level, const char *source, const char *format, ...);