From 2851959877213f23fe5317b9a738d06db41a6666 Mon Sep 17 00:00:00 2001 From: Suraj Jitindar Singh Date: Thu, 27 Apr 2017 14:48:58 +1000 Subject: mboxd: Introduce a new DEBUG log level Currently there is no output on the console unless -v is specified on the command line which enables error output. A second -v will provide info output. We probably want error output irrespective of whether a -v was given on the command line because people generally want to know why their program stopped working. Make error output unconditional. A single -v will give minimal informational output which is a good level to see what the daemon is doing without barfing all over the console. A second -v will enable debug output which will print highly verbose information which will be useful for debugging. Probably don't enable this under normal circumstances. Signed-off-by: Suraj Jitindar Singh Change-Id: I3da25f7e4e9e976c17389fcceb1d85ef98de7e0a --- common.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'common.h') diff --git a/common.h b/common.h index 55b7b1e..581cd0c 100644 --- a/common.h +++ b/common.h @@ -27,16 +27,20 @@ enum { MBOX_LOG_NONE = 0, - MBOX_LOG_VERBOSE = 1, + MBOX_LOG_INFO = 1, MBOX_LOG_DEBUG = 2 } verbosity; -#define MSG_OUT(f_, ...) do { if (verbosity >= MBOX_LOG_DEBUG) { \ +/* Error Messages */ +#define MSG_ERR(f_, ...) mbox_log(LOG_ERR, f_, ##__VA_ARGS__) +/* Informational Messages */ +#define MSG_INFO(f_, ...) do { if (verbosity >= MBOX_LOG_INFO) { \ mbox_log(LOG_INFO, f_, ##__VA_ARGS__); \ } } while (0) -#define MSG_ERR(f_, ...) do { if (verbosity >= MBOX_LOG_VERBOSE) { \ - mbox_log(LOG_ERR, f_, ##__VA_ARGS__); \ - } } while (0) +/* Debug Messages */ +#define MSG_DBG(f_, ...) do { if (verbosity >= MBOX_LOG_DEBUG) { \ + mbox_log(LOG_DEBUG, f_, ##__VA_ARGS__); \ + } } while(0) void (*mbox_vlog)(int p, const char *fmt, va_list args); -- cgit v1.2.1