diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-03-09 19:43:40 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-03-09 19:43:40 +0000 |
commit | a476163c9d9ee1c1c295ce3f9bc8858d33d51b92 (patch) | |
tree | bfced2faad249113fd78b4b4d79bdf11bb9242fe /hcid/logging.c | |
parent | 0df89f0370532854e929d68ef2836a84693acd65 (diff) |
Make debug messages optional, but enable it by default
Diffstat (limited to 'hcid/logging.c')
-rw-r--r-- | hcid/logging.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/hcid/logging.c b/hcid/logging.c index 3b31366a..e478a60e 100644 --- a/hcid/logging.c +++ b/hcid/logging.c @@ -32,12 +32,16 @@ #include "hcid.h" +static volatile int debug_enabled = 0; + void info(const char *format, ...) { va_list ap; va_start(ap, format); + vsyslog(LOG_INFO, format, ap); + va_end(ap); } @@ -46,7 +50,9 @@ void error(const char *format, ...) va_list ap; va_start(ap, format); + vsyslog(LOG_ERR, format, ap); + va_end(ap); } @@ -54,7 +60,22 @@ void debug(const char *format, ...) { va_list ap; + if (!debug_enabled) + return; + va_start(ap, format); + vsyslog(LOG_DEBUG, format, ap); + va_end(ap); } + +void enable_debug() +{ + debug_enabled = 1; +} + +void disable_debug() +{ + debug_enabled = 0; +} |