48 #define MY_NAME "librsync"
50 static void rs_log_va(
int level,
char const *fn,
char const *fmt, va_list va);
54 "EMERGENCY! ",
"ALERT! ",
"CRITICAL! ",
"ERROR: ",
"Warning: ",
67 rs_trace_impl = new_impl;
72 rs_trace_level = level;
75 static void rs_log_va(
int flags,
char const *fn,
char const *fmt, va_list va)
79 if (rs_trace_impl && level <= rs_trace_level) {
83 vsnprintf(buf,
sizeof(buf), fmt, va);
85 snprintf(full_buf,
sizeof(full_buf),
"%s: %s%s\n", MY_NAME,
88 snprintf(full_buf,
sizeof(full_buf),
"%s: %s(%s) %s\n", MY_NAME,
91 rs_trace_impl(level, full_buf);
96 void rs_log0(
int level,
char const *fn,
char const *fmt, ...)
101 rs_log_va(level, fn, fmt, va);
Public header for librsync.
LIBRSYNC_EXPORT void rs_trace_stderr(rs_loglevel level, char const *msg)
Default trace callback that writes to stderr.
void rs_trace_fn_t(rs_loglevel level, char const *msg)
Callback to write out log messages.
rs_loglevel
Log severity levels.
@ RS_LOG_INFO
Informational.
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_supports_trace(void)
Check whether the library was compiled with debugging trace.
void rs_trace_set_level(rs_loglevel level)
Set the least important message severity that will be output.
@ RS_LOG_PRIMASK
Mask to extract priority part.
@ RS_LOG_NONAME
Don't show function name in message.