diff options
author | Luca Muscariello <lumuscar@cisco.com> | 2022-06-09 21:34:09 +0200 |
---|---|---|
committer | Luca Muscariello <muscariello@ieee.org> | 2022-06-30 10:47:50 +0200 |
commit | 6b94663b2455e212009a544ae23bb6a8c55407f8 (patch) | |
tree | 0af780ce5eeb1009fd24b8af8af08e8368eda3bd /lib/src/util/log.c | |
parent | a1ac96f497719b897793ac14b287cb8d840651c1 (diff) |
refactor(lib, hicn-light, vpp, hiperf): HICN-723
- move infra data structure into the shared lib
- new packet cache using double hashing and lookup on prefix suffix
- testing updates
- authenticated requests using interest manifests
Co-authored-by: Mauro Sardara <msardara@cisco.com>
Co-authored-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Co-authored-by: Michele Papalini <micpapal@cisco.com>
Co-authored-by: Olivier Roques <oroques+fdio@cisco.com>
Co-authored-by: Enrico Loparco <eloparco@cisco.com>
Change-Id: Iaddebfe6aa5279ea8553433b0f519578f6b9ccd9
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Diffstat (limited to 'lib/src/util/log.c')
-rw-r--r-- | lib/src/util/log.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/src/util/log.c b/lib/src/util/log.c index 975762603..91a87e848 100644 --- a/lib/src/util/log.c +++ b/lib/src/util/log.c @@ -30,6 +30,10 @@ log_conf_t log_conf = DEFAULT_LOG_CONF; #define FMT_DATETIME_LEN 20 #define snprintf_nowarn(...) (snprintf (__VA_ARGS__) < 0 ? abort () : (void) 0) +#define COLOR_RED "\033[31m" +#define COLOR_YELLOW "\033[33m" +#define COLOR_RESET "\033[0m" + static char ts[FMT_DATETIME_LEN]; static char * @@ -104,7 +108,7 @@ _log_va (int level, const char *fmt, va_list ap) } else { - __android_log_vprint (ANDROID_LOG_INFO, "HICN FACEMGR", fmt, ap); + __android_log_vprint (prio, "HICN FACEMGR", fmt, ap); } #else @@ -112,6 +116,7 @@ _log_va (int level, const char *fmt, va_list ap) if (level > log_conf.log_level) return; + char *color = COLOR_RESET; switch (level) { case LOG_FATAL: @@ -119,9 +124,11 @@ _log_va (int level, const char *fmt, va_list ap) break; case LOG_ERROR: prefix = "ERROR: "; + color = COLOR_RED; break; case LOG_WARN: prefix = "WARNING: "; + color = COLOR_YELLOW; break; case LOG_INFO: prefix = ""; @@ -137,9 +144,9 @@ _log_va (int level, const char *fmt, va_list ap) break; } FILE *f = log_conf.log_file ? log_conf.log_file : stdout; - fprintf (f, "%s %s", timestamp (), prefix); + fprintf (f, "%s%s %s", color, timestamp (), prefix); vfprintf (f, fmt, ap); - fprintf (f, "\n"); + fprintf (f, "%s\n", COLOR_RESET); #ifdef DEBUG fflush (f); #endif |