summaryrefslogtreecommitdiffstats
path: root/src/logging.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-01-10 17:00:43 +0100
committerHarald Welte <laforge@gnumonks.org>2018-01-12 13:57:49 +0000
commit68bf16ab6f5d9738d8d6377ed8bc6285fc09c88e (patch)
treeb8e2e58f5f16b919ae7aa1fa6a2b96f1c12ad7ea /src/logging.c
parent1e50e2ad4813c037b0fbc5559381ec22776225d7 (diff)
log: print loginfo assertions source
Print which function has triggered assert_loginfo(). It's handy in debugging logging-related issues in libosmocore. Change-Id: I8418d0c431106f50aa8779cd89396f02373304ad
Diffstat (limited to 'src/logging.c')
-rw-r--r--src/logging.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/logging.c b/src/logging.c
index 20ec443d..1e0b21b5 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -182,11 +182,11 @@ static const char *loglevel_descriptions[LOGLEVEL_DEFS+1] = {
NULL,
};
-static void assert_loginfo(void)
+static void assert_loginfo(const char *src)
{
if (!osmo_log_info) {
fprintf(stderr, "ERROR: osmo_log_info == NULL! "
- "You must call log_init() before using logging!\n");
+ "You must call log_init() before using logging in %s()!\n", src);
OSMO_ASSERT(osmo_log_info);
}
}
@@ -223,7 +223,7 @@ int log_parse_category(const char *category)
{
int i;
- assert_loginfo();
+ assert_loginfo(__func__);
for (i = 0; i < osmo_log_info->num_cat; ++i) {
if (osmo_log_info->cat[i].name == NULL)
@@ -248,7 +248,7 @@ void log_parse_category_mask(struct log_target* target, const char *_mask)
char *mask = strdup(_mask);
char *category_token = NULL;
- assert_loginfo();
+ assert_loginfo(__func__);
/* Disable everything to enable it afterwards */
for (i = 0; i < osmo_log_info->num_cat; ++i)
@@ -653,7 +653,7 @@ struct log_target *log_target_create(void)
struct log_target *target;
unsigned int i;
- assert_loginfo();
+ assert_loginfo(__func__);
target = talloc_zero(tall_log_ctx, struct log_target);
if (!target)
@@ -827,7 +827,7 @@ const char *log_vty_command_string()
int size = strlen("logging level () ()") + 1;
char *str;
- assert_loginfo();
+ assert_loginfo(__func__);
for (i = 0; i < info->num_cat; i++) {
if (info->cat[i].name == NULL)
@@ -909,7 +909,7 @@ const char *log_vty_command_description()
strlen(LOGGING_STR
"Set the log level for a specified category\n") + 1;
- assert_loginfo();
+ assert_loginfo(__func__);
for (i = 0; i < info->num_cat; i++) {
if (info->cat[i].name == NULL)
@@ -1028,7 +1028,7 @@ int log_check_level(int subsys, unsigned int level)
{
struct log_target *tar;
- assert_loginfo();
+ assert_loginfo(__func__);
subsys = map_subsys(subsys);