#if !(defined (RS_STMT_START) && defined (RS_STMT_END))
# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
# define RS_STMT_START (void)(
# define RS_STMT_END )
# else
# if (defined (sun) || defined (__sun__))
# define RS_STMT_START if (1)
# define RS_STMT_END else (void)0
# else
# define RS_STMT_START do
# define RS_STMT_END while (0)
# endif
# endif
#endif
#include <stdarg.h>
#define DO_RS_TRACE
typedef enum {
RS_LOG_EMERG = 0,
RS_LOG_ALERT = 1,
RS_LOG_CRIT = 2,
RS_LOG_ERR = 3,
RS_LOG_WARNING = 4,
RS_LOG_NOTICE = 5,
RS_LOG_INFO = 6,
RS_LOG_DEBUG = 7
} rs_loglevel;
int rs_loglevel_from_name(const char *name);
enum {
RS_LOG_PRIMASK = 7,
RS_LOG_NONAME = 8,
RS_LOG_NO_PROGRAM = 16,
RS_LOG_NO_PID = 32
};
typedef void rs_logger_fn(int flags, const char *fn,
char const *msg, va_list,
void *private_ptr, int private_int);
void rs_format_msg(char *buf, size_t, int, const char *,
const char *fmt, va_list);
void rs_trace_set_level(rs_loglevel level);
void rs_add_logger(rs_logger_fn *, int level, void *, int);
void rs_remove_logger(rs_logger_fn *, int level, void *, int);
void rs_remove_all_loggers(void);
void rs_logger_file(int level, const char *fn, char const *fmt, va_list va,
void *, int);
void rs_logger_syslog(int level, const char *fn, char const *fmt, va_list va,
void *, int);
int rs_supports_trace(void);
void rs_log0(int level, char const *fn, char const *fmt, ...)
#if defined(__GNUC__)
__attribute__ ((format(printf, 3, 4)))
#endif
;
#if defined(HAVE_VARARG_MACROS) && defined(__GNUC__)
#if 1 || defined(DO_RS_TRACE)
# define rs_trace(fmt, arg...) \
do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \
} while (0)
#else
# define rs_trace(s, str...)
#endif
#define rs_log(l, s, str...) do { \
rs_log0((l), __FUNCTION__, (s) , ##str); \
} while (0)
#define rs_log_crit(s, str...) do { \
rs_log0(RS_LOG_CRIT, __FUNCTION__, (s) , ##str); \
} while (0)
#define rs_log_error(s, str...) do { \
rs_log0(RS_LOG_ERR, __FUNCTION__, (s) , ##str); \
} while (0)
#define rs_log_notice(s, str...) do { \
rs_log0(RS_LOG_NOTICE, __FUNCTION__, (s) , ##str); \
} while (0)
#define rs_log_warning(s, str...) do { \
rs_log0(RS_LOG_WARNING, __FUNCTION__, (s) , ##str); \
} while (0)
#define rs_log_info(s, str...) do { \
rs_log0(RS_LOG_INFO, __FUNCTION__, (s) , ##str); \
} while (0)
#else
#define rs_log rs_log0_nofn
#define rs_trace rs_log_trace_nofn
#define rs_log_info rs_log_info_nofn
#define rs_log_notice rs_log_notice_nofn
#define rs_log_warning rs_log_warning_nofn
#define rs_log_error rs_log_error_nofn
#define rs_log_crit rs_log_critical_nofn
#endif
void rs_log_trace_nofn(char const *s, ...);
void rs_log_info_nofn(char const *, ...);
void rs_log_notice_nofn(char const *, ...);
void rs_log_warning_nofn(char const *s, ...);
void rs_log_error_nofn(char const *s, ...);
void rs_log_critical_nofn(char const *, ...);
void rs_log0_nofn(int level, char const *fmt, ...);
extern int rs_trace_level;
#ifdef DO_RS_TRACE
# define rs_trace_enabled() ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG)
#else
# define rs_trace_enabled() 0
#endif
extern const char *rs_program_name;
void dcc_job_summary_clear(void);
void dcc_job_summary(void);
void dcc_job_summary_append(const char *s);