From: Uwe Hermann Date: Sun, 8 May 2011 18:26:22 +0000 (+0200) Subject: Add sr_spew/SR_LOG_SPEW for even more debug output. X-Git-Tag: libsigrok-0.1.0~253 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=06dd80d424a511736e0c61492bd618a5c3e65cff;p=libsigrok.git Add sr_spew/SR_LOG_SPEW for even more debug output. This is meant for really extensive debug output which can slow down operation significantly and should thus only be enabled if really needed. --- diff --git a/log.c b/log.c index e8cebb1b..02eb9aa3 100644 --- a/log.c +++ b/log.c @@ -32,12 +32,12 @@ static int sr_loglevel = SR_LOG_WARN; /* Show errors+warnings per default. */ * and so on) libsigrok will output. Using SR_LOG_NONE disables all messages. * * @param loglevel The loglevel to set (SR_LOG_NONE, SR_LOG_ERR, SR_LOG_WARN, - * SR_LOG_INFO, or SR_LOG_DBG). + * SR_LOG_INFO, SR_LOG_DBG, or SR_LOG_SPEW). * @return SR_OK upon success, SR_ERR_ARG upon invalid loglevel. */ int sr_set_loglevel(int loglevel) { - if (loglevel < SR_LOG_NONE || loglevel > SR_LOG_DBG) { + if (loglevel < SR_LOG_NONE || loglevel > SR_LOG_SPEW) { sr_err("log: %s: invalid loglevel %d", __func__, loglevel); return SR_ERR_ARG; } @@ -85,6 +85,18 @@ int sr_log(int loglevel, const char *format, ...) return ret; } +int sr_spew(const char *format, ...) +{ + int ret; + va_list args; + + va_start(args, format); + ret = sr_logv(SR_LOG_SPEW, format, args); + va_end(args); + + return ret; +} + int sr_dbg(const char *format, ...) { int ret; diff --git a/sigrok-internal.h b/sigrok-internal.h index db8aef61..d9352f62 100644 --- a/sigrok-internal.h +++ b/sigrok-internal.h @@ -42,6 +42,7 @@ int load_hwplugins(void); /*--- log.c -----------------------------------------------------------------*/ int sr_log(int loglevel, const char *format, ...); +int sr_spew(const char *format, ...); int sr_dbg(const char *format, ...); int sr_info(const char *format, ...); int sr_warn(const char *format, ...); diff --git a/sigrok.h b/sigrok.h index a33cd7f4..89878561 100644 --- a/sigrok.h +++ b/sigrok.h @@ -73,6 +73,7 @@ extern "C" { #define SR_LOG_WARN 2 #define SR_LOG_INFO 3 #define SR_LOG_DBG 4 +#define SR_LOG_SPEW 5 typedef int (*sr_receive_data_callback) (int fd, int revents, void *user_data);