From 1e0aa71d6620ed43b99b5b379c1183dda63f3761 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 19 May 2017 20:49:41 -0400 Subject: [PATCH] Library: log version (INFO) on construction MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- lib/logging.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/logging.c b/lib/logging.c index 4272677d..53c2a846 100644 --- a/lib/logging.c +++ b/lib/logging.c @@ -22,6 +22,9 @@ #include #include +#include + +#define BT_LOG_TAG "LIB" #include BT_HIDDEN @@ -47,6 +50,8 @@ void __attribute__((constructor)) bt_logging_ctor(void) { enum bt_logging_level log_level = BT_LOG_NONE; const char *log_level_env = getenv("BABELTRACE_LOGGING_GLOBAL_LEVEL"); + const char *v_extra = bt_version_get_extra() ? bt_version_get_extra() : + ""; if (!log_level_env) { goto set_level; @@ -68,4 +73,10 @@ void __attribute__((constructor)) bt_logging_ctor(void) set_level: bt_logging_set_global_level(log_level); + BT_LOGI("Babeltrace %d.%d.%d%s library loaded: " + "major=%d, minor=%d, patch=%d, extra=\"%s\"", + bt_version_get_major(), bt_version_get_minor(), + bt_version_get_patch(), v_extra, + bt_version_get_major(), bt_version_get_minor(), + bt_version_get_patch(), v_extra); } -- 2.34.1