Skip to content

Commit 2733aad

Browse files
committed
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
1 parent f22d5ff commit 2733aad

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/log.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ struct {
4545
{NC_VERB_ERROR, "[ERR]"},
4646
{NC_VERB_WARNING, "[WRN]"},
4747
{NC_VERB_VERBOSE, "[INF]"},
48-
{NC_VERB_DEBUG, "[DBG]"}
48+
{NC_VERB_DEBUG, "[DBG]"},
49+
{NC_VERB_DEBUG_LOWLVL, "[DBL]"}
4950
};
5051

5152
#ifdef NC_ENABLED_SSH

src/log.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ typedef enum NC_VERB_LEVEL {
3131
NC_VERB_ERROR = 0, /**< Print only error messages. */
3232
NC_VERB_WARNING = 1, /**< Print error and warning messages. */
3333
NC_VERB_VERBOSE = 2, /**< Besides errors and warnings, print some other verbose messages. */
34-
NC_VERB_DEBUG = 3 /**< Print all messages including some development debug messages. */
34+
NC_VERB_DEBUG = 3, /**< Print almost all messages including some development debug messages. */
35+
NC_VERB_DEBUG_LOWLVL = 4, /**< Print all messages including low level debug messages. */
3536
} NC_VERB_LEVEL;
3637

3738
/**
@@ -77,7 +78,7 @@ void nc_libssh_thread_verbosity(int level);
7778
*/
7879
void nc_set_print_clb(void (*clb)(NC_VERB_LEVEL, const char *));
7980

80-
/**@} Miscellaneous */
81+
/** @} */
8182

8283
#ifdef __cplusplus
8384
}

src/log_p.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ extern volatile uint8_t verbose_level;
4242
#define WRN(format,args...) if(verbose_level>=NC_VERB_WARNING){prv_printf(NC_VERB_WARNING,format,##args);}
4343
#define VRB(format,args...) if(verbose_level>=NC_VERB_VERBOSE){prv_printf(NC_VERB_VERBOSE,format,##args);}
4444
#define DBG(format,args...) if(verbose_level>=NC_VERB_DEBUG){prv_printf(NC_VERB_DEBUG,format,##args);}
45+
#define DBL(format,args...) if(verbose_level>=NC_VERB_DEBUG_LOWLVL){prv_printf(NC_VERB_DEBUG_LOWLVL,format,##args);}
4546

4647
#define ERRMEM ERR("%s: memory reallocation failed (%s:%d).", __func__, __FILE__, __LINE__)
4748
#define ERRARG(arg) ERR("%s: invalid argument (%s).", __func__, arg)

src/session_server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ nc_ps_lock(struct nc_pollsession *ps, uint8_t *id, const char *func)
881881

882882
/* add ourselves into the queue */
883883
nc_ps_queue_add_id(ps, id);
884-
DBG("PS 0x%p TID %lu queue: added %u, head %u, lenght %u", ps, (long unsigned int)pthread_self(), *id,
884+
DBL("PS 0x%p TID %lu queue: added %u, head %u, lenght %u", ps, (long unsigned int)pthread_self(), *id,
885885
ps->queue[ps->queue_begin], ps->queue_len);
886886

887887
/* is it our turn? */
@@ -942,7 +942,7 @@ nc_ps_unlock(struct nc_pollsession *ps, uint8_t id, const char *func)
942942

943943
/* remove ourselves from the queue */
944944
nc_ps_queue_remove_id(ps, id);
945-
DBG("PS 0x%p TID %lu queue: removed %u, head %u, lenght %u", ps, (long unsigned int)pthread_self(), id,
945+
DBL("PS 0x%p TID %lu queue: removed %u, head %u, lenght %u", ps, (long unsigned int)pthread_self(), id,
946946
ps->queue[ps->queue_begin], ps->queue_len);
947947

948948
/* broadcast to all other threads that the queue moved */

0 commit comments

Comments
 (0)