librsync  2.3.4
Macros | Enumerations | Functions | Variables
trace.h File Reference

logging functions. More...

Include dependency graph for trace.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FMT_LONG   "%"PRIdMAX
 
#define FMT_WEAKSUM   "%08"PRIx32
 
#define FMT_SIZE   "%zu"
 
#define rs_trace_enabled()   ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG)
 Call this before putting too much effort into generating trace messages. More...
 
#define rs_trace(...)   rs_log0(RS_LOG_DEBUG, __func__, __VA_ARGS__)
 
#define rs_log(l, ...)   rs_log0((l), __func__, __VA_ARGS__)
 
#define rs_warn(...)   rs_log0(RS_LOG_WARNING, __func__, __VA_ARGS__)
 
#define rs_error(...)   rs_log0(RS_LOG_ERR, __func__, __VA_ARGS__)
 
#define rs_fatal(...)
 

Enumerations

enum  { RS_LOG_PRIMASK = 7 , RS_LOG_NONAME = 8 }
 

Functions

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

Variables

int rs_trace_level
 

Detailed Description

logging functions.

trace may be turned off.

error is always on, but you can return and continue in some way.

fatal terminates the whole process.

Todo:
A function like perror that includes strerror output. Apache does this by adding flags as well as the severity level which say whether such information should be included.

Definition in file trace.h.

Macro Definition Documentation

◆ FMT_LONG

#define FMT_LONG   "%"PRIdMAX

Definition at line 41 of file trace.h.

◆ FMT_WEAKSUM

#define FMT_WEAKSUM   "%08"PRIx32

Definition at line 42 of file trace.h.

◆ FMT_SIZE

#define FMT_SIZE   "%zu"

Definition at line 45 of file trace.h.

◆ rs_trace_enabled

#define rs_trace_enabled ( )    ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG)

Call this before putting too much effort into generating trace messages.

Definition at line 70 of file trace.h.

◆ rs_trace

#define rs_trace (   ...)    rs_log0(RS_LOG_DEBUG, __func__, __VA_ARGS__)

Definition at line 71 of file trace.h.

◆ rs_log

#define rs_log (   l,
  ... 
)    rs_log0((l), __func__, __VA_ARGS__)

Definition at line 77 of file trace.h.

◆ rs_warn

#define rs_warn (   ...)    rs_log0(RS_LOG_WARNING, __func__, __VA_ARGS__)

Definition at line 78 of file trace.h.

◆ rs_error

#define rs_error (   ...)    rs_log0(RS_LOG_ERR, __func__, __VA_ARGS__)

Definition at line 79 of file trace.h.

◆ rs_fatal

#define rs_fatal (   ...)
Value:
do { \
rs_log0(RS_LOG_CRIT, __func__, __VA_ARGS__); \
abort(); \
} while (0)
@ RS_LOG_CRIT
Critical conditions.
Definition: librsync.h:121

Definition at line 80 of file trace.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RS_LOG_PRIMASK 

Mask to extract priority part.

RS_LOG_NONAME 

Don't show function name in message.

Definition at line 85 of file trace.h.

Variable Documentation

◆ rs_trace_level

int rs_trace_level
extern

Definition at line 38 of file trace.c.