From 0ee90b745f28a543f7cc355591b36bddfe3a30e1 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 14 Jun 2019 21:14:06 -0400 Subject: [PATCH] Add internal bt_common_logging_level_string() Signed-off-by: Philippe Proulx Change-Id: I6fd26a0657d93efc8a30d6055d755c5e2b852f2e Reviewed-on: https://review.lttng.org/c/babeltrace/+/1453 Tested-by: jenkins Reviewed-by: Francis Deslauriers --- src/common/common.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/common/common.h b/src/common/common.h index 570eec67..c62da1a3 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include "common/assert.h" @@ -562,6 +563,30 @@ const char *bt_common_self_message_iterator_status_string( } }; +static inline +const char *bt_common_logging_level_string( + enum bt_logging_level level) +{ + switch (level) { + case BT_LOGGING_LEVEL_VERBOSE: + return "BT_LOGGING_LEVEL_VERBOSE"; + case BT_LOGGING_LEVEL_DEBUG: + return "BT_LOGGING_LEVEL_DEBUG"; + case BT_LOGGING_LEVEL_INFO: + return "BT_LOGGING_LEVEL_INFO"; + case BT_LOGGING_LEVEL_WARN: + return "BT_LOGGING_LEVEL_WARN"; + case BT_LOGGING_LEVEL_ERROR: + return "BT_LOGGING_LEVEL_ERROR"; + case BT_LOGGING_LEVEL_FATAL: + return "BT_LOGGING_LEVEL_FATAL"; + case BT_LOGGING_LEVEL_NONE: + return "BT_LOGGING_LEVEL_NONE"; + default: + return "(unknown)"; + } +}; + #define NS_PER_S_I INT64_C(1000000000) #define NS_PER_S_U UINT64_C(1000000000) -- 2.34.1