librsync  2.3.2
Macros | Functions | Variables
trace.c File Reference

logging and debugging output. More...

Go to the source code of this file.

Macros

#define MY_NAME   "librsync"
 

Functions

static void rs_log_va (int level, char const *fn, char const *fmt, va_list va)
 
void rs_trace_to (rs_trace_fn_t *new_impl)
 Set the destination of trace information.
 
void rs_trace_set_level (rs_loglevel level)
 Set the least important message severity that will be output.
 
void rs_log0 (int level, char const *fn, char const *fmt,...)
 
void rs_trace_stderr (rs_loglevel UNUSED(level), char const *msg)
 
int rs_supports_trace (void)
 Check whether the library was compiled with debugging trace.
 

Variables

rs_trace_fn_trs_trace_impl = rs_trace_stderr
 
int rs_trace_level = RS_LOG_INFO
 
static const char * rs_severities []
 Log severity strings, if any.
 

Detailed Description

logging and debugging output.

Todo:
Have a bit set in the log level that says not to include the function name.

Definition in file trace.c.

Macro Definition Documentation

◆ MY_NAME

#define MY_NAME   "librsync"

Definition at line 48 of file trace.c.

Function Documentation

◆ rs_log_va()

static void rs_log_va ( int  level,
char const *  fn,
char const *  fmt,
va_list  va 
)
static

Definition at line 75 of file trace.c.

◆ rs_trace_to()

void rs_trace_to ( rs_trace_fn_t new_impl)

Set the destination of trace information.

Set trace callback.

The callback scheme allows for use within applications that may have their own particular ways of reporting errors: log files for a web server, perhaps, and an error dialog for a browser.

Todo:
Do we really need such fine-grained control, or just yes/no tracing?

Definition at line 65 of file trace.c.

◆ rs_trace_set_level()

void rs_trace_set_level ( rs_loglevel  level)

Set the least important message severity that will be output.

See also
Debugging trace and error logging

Definition at line 70 of file trace.c.

◆ rs_log0()

void rs_log0 ( int  level,
char const *  fn,
char const *  fmt,
  ... 
)

Definition at line 96 of file trace.c.

◆ rs_trace_stderr()

void rs_trace_stderr ( rs_loglevel   UNUSEDlevel,
char const *  msg 
)

Definition at line 105 of file trace.c.

◆ rs_supports_trace()

int rs_supports_trace ( void  )

Check whether the library was compiled with debugging trace.

Returns
True if the library contains trace code; otherwise false.

If this returns false, then trying to turn trace on will achieve nothing.

See also
Debugging trace and error logging

Definition at line 110 of file trace.c.

Variable Documentation

◆ rs_trace_impl

rs_trace_fn_t* rs_trace_impl = rs_trace_stderr

Definition at line 44 of file trace.c.

◆ rs_trace_level

int rs_trace_level = RS_LOG_INFO

Definition at line 46 of file trace.c.

◆ rs_severities

const char* rs_severities[]
static
Initial value:
= {
"EMERGENCY! ", "ALERT! ", "CRITICAL! ", "ERROR: ", "Warning: ",
"", "", ""
}

Log severity strings, if any.

Must match ordering in rs_loglevel.

Definition at line 53 of file trace.c.