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, ...)
static const char * rs_severities[]
Log severity strings, if any.
void rs_trace_to(rs_trace_fn_t *new_impl)
Set the destination of trace information.
int rs_trace_level
\macro rs_trace_enabled()
Don't show function name in message.
Public header for librsync.
int rs_supports_trace(void)
Check whether the library was compiled with debugging trace.
void rs_trace_stderr(rs_loglevel level, char const *msg)
Default trace callback that writes to stderr.
Mask to extract priority part.
void rs_trace_set_level(rs_loglevel level)
Set the least important message severity that will be output.
rs_loglevel
Log severity levels.