#include "signal.h"
#include "version.h"
+__printf_2_3 void (*para_log)(int, const char*, ...) = daemon_log;
/** define the array of error lists needed by para_audiod */
INIT_AUDIOD_ERRLISTS;
/** define the array containing all supported audio formats */
* \param ll The log level.
* \param fmt The format string describing the log message.
*/
-__printf_2_3 void para_log(int ll, const char* fmt,...)
+__printf_2_3 void daemon_log(int ll, const char* fmt,...)
{
va_list argp;
FILE *fp;
void daemon_set_loglevel(char *loglevel);
void daemon_set_default_log_colors(void);
void daemon_set_log_color_or_die(char const *arg);
+__printf_2_3 void daemon_log(int ll, const char* fmt,...);
/** Daemon log configuration flags. */
enum daemon_flags {
INIT_FADE_ERRLISTS;
static struct fade_args_info conf;
-__printf_2_3 void para_log(__a_unused int ll, const char *fmt, ...)
+__printf_2_3 void date_log(__a_unused int ll, const char *fmt, ...)
{
va_list argp;
time_t t1;
vprintf(fmt, argp);
va_end(argp);
}
+__printf_2_3 void (*para_log)(int, const char*, ...) = date_log;
/*
* Open the mixer device.
static int loglevel;
-__printf_2_3 void para_log(int ll, const char *fmt,...)
+__printf_2_3 void curses_log(int ll, const char *fmt,...)
{
int color;
char *msg;
rb_add_entry(color, msg);
wrefresh(bot.win);
}
+__printf_2_3 void (*para_log)(int, const char*, ...) = curses_log;
static void setup_signal_handling(void)
{
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) \
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 "
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.
*
#include "color.h"
#include "version.h"
+__printf_2_3 void (*para_log)(int, const char*, ...) = daemon_log;
+
/** Define the array of error lists needed by para_server. */
INIT_SERVER_ERRLISTS;