X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=common%2Fcommon.h;h=af393e556c7b2454037ce414bf95246dbefcff04;hb=56eeb7d73ed0c82f2a8165b6aba525af73c58f73;hp=40eb0a2d55b4d255ca1d6708ce678cb5cac19c50;hpb=f78d6baee60179e6ce41cc7058a8df5857116010;p=apps%2Fpfixtools.git diff --git a/common/common.h b/common/common.h index 40eb0a2..af393e5 100644 --- a/common/common.h +++ b/common/common.h @@ -63,7 +63,7 @@ typedef int (*initcall_t)(void); typedef void (*exitcall_t)(void); -void common_register_exit(exitcall_t _exit); +void common_register_exit(exitcall_t exitcall); void common_init(void); #define module_init(fn) \ @@ -94,14 +94,14 @@ void common_init(void); : (L) == LOG_ALERT ? "alert " \ : "??? " ) -#define __log(Level, Fmt, ...) \ - if (log_level >= Level) { \ - if (log_syslog) { \ - syslog(Level, Fmt, ##__VA_ARGS__); \ - } else { \ - fprintf(stderr, "[%s] " Fmt "\n", \ - __level_name(Level), ##__VA_ARGS__); \ - } \ +#define __log(Level, Fmt, ...) \ + if (log_level >= Level) { \ + if (log_syslog) { \ + syslog(Level, "%s" Fmt, log_state, ##__VA_ARGS__); \ + } else { \ + fprintf(stderr, "[%s] %s" Fmt "\n", \ + __level_name(Level), log_state, ##__VA_ARGS__);\ + } \ } #define debug(Fmt, ...) __log(LOG_DEBUG, Fmt, ##__VA_ARGS__) @@ -118,6 +118,7 @@ void common_init(void); extern int log_level; extern bool log_syslog; +extern const char *log_state; void common_sighandler(int sig);