26 #ifndef ORTP_LOGGING_H 27 #define ORTP_LOGGING_H 29 #include <ortp/port.h> 47 typedef void (*OrtpLogFunc)(OrtpLogLevel lev,
const char *fmt, va_list args);
52 ORTP_VAR_PUBLIC OrtpLogFunc ortp_logv_out;
54 #define ortp_log_level_enabled(level) (ortp_get_log_level_mask() & (level)) 56 #if !defined(WIN32) && !defined(_WIN32_WCE) 57 #define ortp_logv(level,fmt,args) \ 59 if (ortp_logv_out!=NULL && ortp_log_level_enabled(level)) \ 60 ortp_logv_out(level,fmt,args);\ 61 if ((level)==ORTP_FATAL) abort();\ 64 ORTP_PUBLIC
void ortp_logv(
int level,
const char *fmt, va_list args);
68 ORTP_PUBLIC
int ortp_get_log_level_mask(
void);
71 #define CHECK_FORMAT_ARGS(m,n) __attribute__((format(printf,m,n))) 73 #define CHECK_FORMAT_ARGS(m,n) 77 #ifdef ORTP_DEBUG_MODE 78 static inline void CHECK_FORMAT_ARGS(1,2) ortp_debug(const
char *fmt,...)
82 ortp_logv(ORTP_DEBUG, fmt, args);
87 #define ortp_debug(...) 91 #ifdef ORTP_NOMESSAGE_MODE 94 #define ortp_message(...) 95 #define ortp_warning(...) 99 static inline void CHECK_FORMAT_ARGS(2,3) ortp_log(OrtpLogLevel lev, const
char *fmt,...) {
101 va_start (args, fmt);
102 ortp_logv(lev, fmt, args);
106 static inline void CHECK_FORMAT_ARGS(1,2) ortp_message(const
char *fmt,...)
109 va_start (args, fmt);
110 ortp_logv(ORTP_MESSAGE, fmt, args);
114 static inline void CHECK_FORMAT_ARGS(1,2) ortp_warning(const
char *fmt,...)
117 va_start (args, fmt);
118 ortp_logv(ORTP_WARNING, fmt, args);
124 static inline void CHECK_FORMAT_ARGS(1,2) ortp_error(const
char *fmt,...)
127 va_start (args, fmt);
128 ortp_logv(ORTP_ERROR, fmt, args);
132 static inline void CHECK_FORMAT_ARGS(1,2) ortp_fatal(const
char *fmt,...)
135 va_start (args, fmt);
136 ortp_logv(ORTP_FATAL, fmt, args);
ORTP_PUBLIC void ortp_set_log_file(FILE *file)
Definition: logging.c:30
ORTP_PUBLIC void ortp_set_log_handler(OrtpLogFunc func)
Definition: logging.c:43
ORTP_PUBLIC void ortp_set_log_level_mask(int levelmask)
Definition: logging.c:54