log CHANGE new low-level debug log level
For messages that should be explicitly requested
because they significantly (printed periodically)
clutter the output.
Fixes cesnet/netopeer2#591
diff --git a/src/log.c b/src/log.c
index 614efcc..57ca05c 100644
--- a/src/log.c
+++ b/src/log.c
@@ -45,7 +45,8 @@
{NC_VERB_ERROR, "[ERR]"},
{NC_VERB_WARNING, "[WRN]"},
{NC_VERB_VERBOSE, "[INF]"},
- {NC_VERB_DEBUG, "[DBG]"}
+ {NC_VERB_DEBUG, "[DBG]"},
+ {NC_VERB_DEBUG_LOWLVL, "[DBL]"}
};
#ifdef NC_ENABLED_SSH
diff --git a/src/log.h b/src/log.h
index b8dbd1c..7933e28 100644
--- a/src/log.h
+++ b/src/log.h
@@ -31,7 +31,8 @@
NC_VERB_ERROR = 0, /**< Print only error messages. */
NC_VERB_WARNING = 1, /**< Print error and warning messages. */
NC_VERB_VERBOSE = 2, /**< Besides errors and warnings, print some other verbose messages. */
- NC_VERB_DEBUG = 3 /**< Print all messages including some development debug messages. */
+ NC_VERB_DEBUG = 3, /**< Print almost all messages including some development debug messages. */
+ NC_VERB_DEBUG_LOWLVL = 4, /**< Print all messages including low level debug messages. */
} NC_VERB_LEVEL;
/**
@@ -77,7 +78,7 @@
*/
void nc_set_print_clb(void (*clb)(NC_VERB_LEVEL, const char *));
-/**@} Miscellaneous */
+/** @} */
#ifdef __cplusplus
}
diff --git a/src/log_p.h b/src/log_p.h
index 5cb6aa0..d142131 100644
--- a/src/log_p.h
+++ b/src/log_p.h
@@ -42,6 +42,7 @@
#define WRN(format,args...) if(verbose_level>=NC_VERB_WARNING){prv_printf(NC_VERB_WARNING,format,##args);}
#define VRB(format,args...) if(verbose_level>=NC_VERB_VERBOSE){prv_printf(NC_VERB_VERBOSE,format,##args);}
#define DBG(format,args...) if(verbose_level>=NC_VERB_DEBUG){prv_printf(NC_VERB_DEBUG,format,##args);}
+#define DBL(format,args...) if(verbose_level>=NC_VERB_DEBUG_LOWLVL){prv_printf(NC_VERB_DEBUG_LOWLVL,format,##args);}
#define ERRMEM ERR("%s: memory reallocation failed (%s:%d).", __func__, __FILE__, __LINE__)
#define ERRARG(arg) ERR("%s: invalid argument (%s).", __func__, arg)
diff --git a/src/session_server.c b/src/session_server.c
index 763fcf4..919d406 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -881,7 +881,7 @@
/* add ourselves into the queue */
nc_ps_queue_add_id(ps, id);
- DBG("PS 0x%p TID %lu queue: added %u, head %u, lenght %u", ps, (long unsigned int)pthread_self(), *id,
+ DBL("PS 0x%p TID %lu queue: added %u, head %u, lenght %u", ps, (long unsigned int)pthread_self(), *id,
ps->queue[ps->queue_begin], ps->queue_len);
/* is it our turn? */
@@ -942,7 +942,7 @@
/* remove ourselves from the queue */
nc_ps_queue_remove_id(ps, id);
- DBG("PS 0x%p TID %lu queue: removed %u, head %u, lenght %u", ps, (long unsigned int)pthread_self(), id,
+ DBL("PS 0x%p TID %lu queue: removed %u, head %u, lenght %u", ps, (long unsigned int)pthread_self(), id,
ps->queue[ps->queue_begin], ps->queue_len);
/* broadcast to all other threads that the queue moved */