aboutsummaryrefslogtreecommitdiffstats
path: root/src/verbose.h
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-10-22 16:44:03 +0200
committerLoïc Collignon <loic.collignon@iot.bzh>2018-10-23 11:56:42 +0200
commitdfe85ca516c207eadc4ae77066c6706f17068f20 (patch)
tree07f0b87dd8d7da0b60ad12fefee5253ab511cfa4 /src/verbose.h
parent61a01510306f60422df3cd3e67513d3c7b585524 (diff)
Added an option to color out the ouput
Enhance the readability using basic colorization to the logging system. As the '--call' option is almost unused, it doesn't require to have a shortname. So we use the '-c' and '--color' for the new colorization option, and keep only the longname for the 'call' option. Change-Id: I095fc9f38133fb742e0f0003540cd120feec8f5e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'src/verbose.h')
-rw-r--r--src/verbose.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/verbose.h b/src/verbose.h
index bd36f97e..183932bb 100644
--- a/src/verbose.h
+++ b/src/verbose.h
@@ -109,6 +109,8 @@ extern void verbose_inc();
extern void verbose_clear();
extern void verbose_add(int level);
extern void verbose_sub(int level);
+extern void verbose_colorize();
+extern int verbose_is_colorized();
extern int verbose_level_of_name(const char *name);
extern const char *verbose_name_of_level(int level);
@@ -120,3 +122,15 @@ extern void verbosity_set(int verbo);
extern int verbosity_from_mask(int mask);
extern int verbosity_to_mask(int verbo);
+#define COLOR_EMERGENCY "\x1B[101m"
+#define COLOR_ALERT "\x1B[43m"
+#define COLOR_CRITICAL "\x1B[41m"
+#define COLOR_ERROR "\x1B[91m"
+#define COLOR_WARNING "\x1B[93m"
+#define COLOR_NOTICE "\x1B[94m"
+#define COLOR_INFO "\x1B[96m"
+#define COLOR_DEBUG "\x1B[95m"
+#define COLOR_API "\x1B[1m"
+#define COLOR_FILE "\x1B[90m"
+#define COLOR_DEFAULT "\x1B[0m"
+