38 # define STDERR_FILENO 2
41 #ifdef HAVE_SYS_FILE_H
42 # include <sys/file.h>
58 #ifdef HAVE_PROGRAM_INVOCATION_NAME
59 # define MY_NAME program_invocation_short_name
61 # define MY_NAME "librsync"
64 static void rs_log_va(
int level,
char const *fn,
char const *fmt, va_list va);
68 "EMERGENCY! ",
"ALERT! ",
"CRITICAL! ",
"ERROR: ",
"Warning: ",
81 rs_trace_impl = new_impl;
89 static void rs_log_va(
int flags,
char const *fn,
char const *fmt, va_list va)
97 vsnprintf(buf,
sizeof buf - 1, fmt, va);
100 snprintf(full_buf,
sizeof full_buf - 1,
"%s: %s%s\n", MY_NAME,
103 snprintf(full_buf,
sizeof full_buf - 1,
"%s: %s(%s) %s\n", MY_NAME,
107 rs_trace_impl(level, full_buf);
113 void rs_log0_nofn(
int level,
char const *fmt, ...)
118 rs_log_va(level, PACKAGE, fmt, va);
123 void rs_log0(
int level,
char const *fn,
char const *fmt, ...)
128 rs_log_va(level, fn, fmt, va);
135 write(STDERR_FILENO, msg, strlen(msg));
139 void rs_fatal0(
char const *s, ...)
150 void rs_error0(
char const *s, ...)
160 void rs_trace0(
char const *s, ...)