X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=para.h;h=96492baaf35ce666c37e31c6a60e8af5a6573333;hp=bc6aa929539ee4a9c1abb8e0d2b14695d88870cc;hb=53077ea78f01e197e84529ae42558af5c3a68429;hpb=63aab30b55d5809704a2d0e1c4e8de20e8228d7d diff --git a/para.h b/para.h index bc6aa929..96492baa 100644 --- a/para.h +++ b/para.h @@ -49,15 +49,19 @@ typeof(x) _x = (x); \ _x > 0? _x : -_x; }) + +extern __printf_2_3 void (*para_log)(int, const char*, ...); /** * Define a standard log function that always writes to stderr. * + * \param funcname The name of the function to be defined. + * * \param loglevel_barrier If the loglevel of the current message * is less than that, the message is going to be ignored. * */ -#define INIT_STDERR_LOGGING(loglevel_barrier) \ - __printf_2_3 void para_log(int ll, const char* fmt,...) \ +#define DEFINE_STDERR_LOGGER(funcname, loglevel_barrier) \ + __printf_2_3 void funcname(int ll, const char* fmt,...) \ { \ va_list argp; \ if (ll < loglevel_barrier) \ @@ -66,6 +70,9 @@ vfprintf(stderr, fmt, argp); \ va_end(argp); \ } +#define INIT_STDERR_LOGGING(loglevel_barrier) \ + DEFINE_STDERR_LOGGER(stderr_log, loglevel_barrier); \ + __printf_2_3 void (*para_log)(int, const char*, ...) = stderr_log; /** Sent by para_client to initiate the authentication procedure. */ #define AUTH_REQUEST_MSG "auth rsa " @@ -105,8 +112,6 @@ extern const char *status_item_list[]; int for_each_stat_item(char *item_buf, size_t num_bytes, int (*item_handler)(int, char *)); -__printf_2_3 void para_log(int, const char*, ...); - /** * Write a log message to a dynamically allocated string. *