librsync  2.0.2
trace.md
1 # Debugging trace and error logging {#api_trace}
2 
3 librsync can output trace or log messages as it proceeds.
4 Error
5 messages supplement return codes by describing in more detail what went
6 wrong. Debug messages are useful when debugging librsync or applications
7 that call it.
8 
9 These
10 follow a fairly standard priority-based filtering system
11 (rs_trace_set_level()), using the same severity levels as UNIX syslog.
12 Messages by default are sent to stderr, but may be passed to an
13 application-provided callback (rs_trace_to(), rs_trace_fn_t()).
14 
15 The default configuration is that warning and error messages are written
16 to stderr. This should be appropriate for many applications. If it is
17 not, the level and destination of messages may be changed.
18 
19 Messages are passed out of librsync through a trace callback which is
20 passed a severity and message string. The type for this callback is
21 \ref rs_trace_fn_t.
22 
23 The default trace function is \ref rs_trace_stderr.
24 
25 The trace callback may be changed at runtime with \ref rs_trace_to.
26 
27 Messages from librsync are labelled with a severity indicator of
28 enumerated type \ref rs_loglevel.
29 
30 The application may also specify a minimum severity of interest through
32 Messages lower than the specified level
33 are discarded without being passed to the trace callback.
void rs_trace_to(rs_trace_fn_t *)
Set trace callback.
Definition: trace.c:79
void rs_trace_stderr(rs_loglevel level, char const *msg)
Default trace callback that writes to stderr.
void rs_trace_set_level(rs_loglevel level)
Set the least important message severity that will be output.
Definition: trace.c:84
rs_loglevel
Log severity levels.
Definition: librsync.h:100