From 89073cfbba6126ce28221ad54e75a69b05b21fd6 Mon Sep 17 00:00:00 2001 From: Eric Wong <normalperson@yhbt.net> Date: Tue, 1 Aug 2006 04:18:53 +0000 Subject: logging cleanups * Moved all logging-related stuff into log.c (and not myfprintf.c) * ISO C90-compliant strftime usage: %e and %R replaced with %d and %H:%M respectively * Got rid of variadic macros since some old-school compilers don't like them * compiling with -DNDEBUG disables the DEBUG() macro git-svn-id: https://svn.musicpd.org/mpd/trunk@4512 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/log.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/log.h') diff --git a/src/log.h b/src/log.h index 2e888a510..0fb69ac7a 100644 --- a/src/log.h +++ b/src/log.h @@ -29,28 +29,28 @@ #define LOG_LEVEL_SECURE 1 #define LOG_LEVEL_DEBUG 2 -extern int logLevel; -extern short warningFlushed; - -#define ERROR(...) fdprintf(STDERR_FILENO, __VA_ARGS__) +#ifndef NDEBUG + mpd_printf void DEBUG(const char *fmt, ...); +#else + static inline void DEBUG(const char *fmt, ...) { } +#endif -#define LOG(...) fdprintf(STDOUT_FILENO, __VA_ARGS__) +mpd_printf void ERROR(const char *fmt, ...); +mpd_printf void LOG(const char *fmt, ...); +mpd_printf void SECURE(const char *fmt, ...); +mpd_printf void WARNING(const char *fmt, ...); +mpd_printf void FATAL(const char *fmt, ...); -#define SECURE(...) if(logLevel>=LOG_LEVEL_SECURE) \ - fdprintf(STDOUT_FILENO, __VA_ARGS__) +void initLog(const int verbose); -#define DEBUG(...) if(logLevel>=LOG_LEVEL_DEBUG) \ - fdprintf(STDOUT_FILENO, __VA_ARGS__) +void setup_log_output(const int use_stdout); -#define WARNING(...) { \ - if(warningFlushed) fdprintf(STDERR_FILENO, __VA_ARGS__); \ - else bufferWarning(__VA_ARGS__); \ -} +void open_log_files(const int use_stdout); -void initLog(); +int cycle_log_files(void); -void bufferWarning(char *format, ...); +void close_log_files(void); void flushWarningLog(); -#endif +#endif /* LOG_H */ -- cgit v1.2.3