From f645b538c8f3dd88ce9a9ad5dbeb6cf341ad74ab Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 15 Jan 2009 18:47:53 +0100 Subject: [PATCH] Prefix loglevel macros with "LL_". --- audiod.c | 2 +- gui.c | 12 ++++++------ para.h | 56 ++++++++++++++++++++++++++++---------------------------- server.c | 4 ++-- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/audiod.c b/audiod.c index fc4ac6f5..12aa9d7a 100644 --- a/audiod.c +++ b/audiod.c @@ -207,7 +207,7 @@ __printf_2_3 void para_log(int ll, const char* fmt,...) tm = localtime(&t1); strftime(str, MAXLINE, "%b %d %H:%M:%S", tm); fprintf(outfd, "%s %s ", str, hostname); - if (conf.loglevel_arg <= INFO) + if (conf.loglevel_arg <= LL_INFO) fprintf(outfd, "%i ", ll); va_start(argp, fmt); vfprintf(outfd, fmt, argp); diff --git a/gui.c b/gui.c index 982f6884..f08976d2 100644 --- a/gui.c +++ b/gui.c @@ -497,9 +497,9 @@ __printf_2_3 void para_log(int ll, const char *fmt,...) if (ll < conf.loglevel_arg || !curses_active) return; switch (ll) { - case DEBUG: - case INFO: - case NOTICE: + case LL_DEBUG: + case LL_INFO: + case LL_NOTICE: color = COLOR_MSG; break; default: @@ -563,7 +563,7 @@ __noreturn __printf_2_3 static void msg_n_exit(int ret, const char* fmt, ...) static void print_welcome(void) { int ll = conf.loglevel_arg; - if (ll > NOTICE) + if (ll > LL_NOTICE) return; outputf(COLOR_WELCOME, "Welcome to para_gui " PACKAGE_VERSION " \"" CODENAME "\". Theme: %s", theme.name); @@ -1168,7 +1168,7 @@ err_out: static void com_ll_decr(void) { - if (conf.loglevel_arg <= DEBUG) { + if (conf.loglevel_arg <= LL_DEBUG) { print_in_bar(COLOR_ERRMSG, "loglevel already at maximal verbosity\n"); return; @@ -1179,7 +1179,7 @@ static void com_ll_decr(void) static void com_ll_incr(void) { - if (conf.loglevel_arg >= EMERG) { + if (conf.loglevel_arg >= LL_EMERG) { print_in_bar(COLOR_ERRMSG, "loglevel already at miminal verbosity\n"); return; diff --git a/para.h b/para.h index f456eebd..4022bec7 100644 --- a/para.h +++ b/para.h @@ -49,63 +49,63 @@ typeof(x) _x = (x); \ _x > 0? _x : -_x; }) -/** debug loglevel, gets really noisy */ -#define DEBUG 1 -/** still noisy, but won't fill your disk */ -#define INFO 2 -/** normal, but significant event */ -#define NOTICE 3 -/** unexpected event that can be handled */ -#define WARNING 4 -/** unhandled error condition */ -#define ERROR 5 -/** system might be unreliable */ -#define CRIT 6 -/** last message before exit */ -#define EMERG 7 +/** Debug loglevel, gets really noisy. */ +#define LL_DEBUG 1 +/** Still noisy, but won't fill your disk. */ +#define LL_INFO 2 +/** Normal, but significant event. */ +#define LL_NOTICE 3 +/** Unexpected event that can be handled. */ +#define LL_WARNING 4 +/** Unhandled error condition. */ +#define LL_ERROR 5 +/** System might be unreliable. */ +#define LL_CRIT 6 +/** Last message before exit. */ +#define LL_EMERG 7 /** Log messages with lower priority than that will not be compiled in. */ #define COMPILE_TIME_LOGLEVEL 0 /** \cond */ -#if DEBUG > COMPILE_TIME_LOGLEVEL -#define PARA_DEBUG_LOG(f,...) para_log(DEBUG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#if LL_DEBUG > COMPILE_TIME_LOGLEVEL +#define PARA_DEBUG_LOG(f,...) para_log(LL_DEBUG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) #else #define PARA_DEBUG_LOG(...) do {;} while (0) #endif -#if INFO > COMPILE_TIME_LOGLEVEL -#define PARA_INFO_LOG(f,...) para_log(INFO, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#if LL_INFO > COMPILE_TIME_LOGLEVEL +#define PARA_INFO_LOG(f,...) para_log(LL_INFO, "%s: " f, __FUNCTION__, ## __VA_ARGS__) #else #define PARA_INFO_LOG(...) do {;} while (0) #endif -#if NOTICE > COMPILE_TIME_LOGLEVEL -#define PARA_NOTICE_LOG(f,...) para_log(NOTICE, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#if LL_NOTICE > COMPILE_TIME_LOGLEVEL +#define PARA_NOTICE_LOG(f,...) para_log(LL_NOTICE, "%s: " f, __FUNCTION__, ## __VA_ARGS__) #else #define PARA_NOTICE_LOG(...) do {;} while (0) #endif -#if WARNING > COMPILE_TIME_LOGLEVEL -#define PARA_WARNING_LOG(f,...) para_log(WARNING, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#if LL_WARNING > COMPILE_TIME_LOGLEVEL +#define PARA_WARNING_LOG(f,...) para_log(LL_WARNING, "%s: " f, __FUNCTION__, ## __VA_ARGS__) #else #define PARA_WARNING_LOG(...) do {;} while (0) #endif -#if ERROR > COMPILE_TIME_LOGLEVEL -#define PARA_ERROR_LOG(f,...) para_log(ERROR, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#if LL_ERROR > COMPILE_TIME_LOGLEVEL +#define PARA_ERROR_LOG(f,...) para_log(LL_ERROR, "%s: " f, __FUNCTION__, ## __VA_ARGS__) #else #define PARA_ERROR_LOG(...) do {;} while (0) #endif -#if CRIT > COMPILE_TIME_LOGLEVEL -#define PARA_CRIT_LOG(f,...) para_log(CRIT, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#if LL_CRIT > COMPILE_TIME_LOGLEVEL +#define PARA_CRIT_LOG(f,...) para_log(LL_CRIT, "%s: " f, __FUNCTION__, ## __VA_ARGS__) #else #define PARA_CRIT_LOG(...) do {;} while (0) #endif -#if EMERG > COMPILE_TIME_LOGLEVEL -#define PARA_EMERG_LOG(f,...) para_log(EMERG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#if LL_EMERG > COMPILE_TIME_LOGLEVEL +#define PARA_EMERG_LOG(f,...) para_log(LL_EMERG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) #else #define PARA_EMERG_LOG(...) #endif diff --git a/server.c b/server.c index 2c2f31c1..c9400e9c 100644 --- a/server.c +++ b/server.c @@ -153,10 +153,10 @@ __printf_2_3 void para_log(int ll, const char* fmt,...) tm = localtime(&t1); strftime(str, MAXLINE, "%b %d %H:%M:%S", tm); fprintf(outfd, "%s ", str); - if (conf.loglevel_arg <= INFO) + if (conf.loglevel_arg <= LL_INFO) fprintf(outfd, "%i: ", ll); mypid = getpid(); - if (conf.loglevel_arg <= INFO) + if (conf.loglevel_arg <= LL_INFO) fprintf(outfd, "(%d) ", (int)mypid); va_start(argp, fmt); vfprintf(outfd, fmt, argp); -- 2.30.2