Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 6b0d7a9d authored by Alexandre Bailon's avatar Alexandre Bailon
Browse files

debug: Add color to logs


Update log helpers to print errors in red and warnings in yellow.
It should make more easier to see errors and warnings when they printed
between greybus operation dump.

Signed-off-by: default avatarAlexandre Bailon <abailon@baylibre.com>
parent 5bec689f
No related merge requests found
......@@ -22,6 +22,10 @@
#include <stdio.h>
#include <stdint.h>
#define COLOR_RED "\x1b[31m"
#define COLOR_YELLOW "\x1b[33m"
#define COLOR_RESET "\x1b[0m"
enum log_level {
LL_ERROR = 0,
LL_WARNING,
......@@ -39,10 +43,10 @@ enum log_level {
} while (0)
#define pr_err(format, ...) \
ll_print(LL_ERROR, format, ##__VA_ARGS__)
ll_print(LL_ERROR, COLOR_RED format COLOR_RESET, ##__VA_ARGS__)
#define pr_warn(format, ...) \
ll_print(LL_WARNING, format, ##__VA_ARGS__)
ll_print(LL_WARNING, COLOR_YELLOW format COLOR_RESET, ##__VA_ARGS__)
#define pr_info(format, ...) \
ll_print(LL_INFO, format, ##__VA_ARGS__)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment