47typedef void (*OrtpLogFunc)(OrtpLogLevel lev,
const char *fmt, va_list args);
52ORTP_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();\
64ORTP_PUBLIC
void ortp_logv(
int level,
const char *fmt, va_list args);
68ORTP_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)
78static 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(...)
99static 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);
106static inline void CHECK_FORMAT_ARGS(1,2) ortp_message(const
char *fmt,...)
109 va_start (args, fmt);
110 ortp_logv(ORTP_MESSAGE, fmt, args);
114static inline void CHECK_FORMAT_ARGS(1,2) ortp_warning(const
char *fmt,...)
117 va_start (args, fmt);
118 ortp_logv(ORTP_WARNING, fmt, args);
124static inline void CHECK_FORMAT_ARGS(1,2) ortp_error(const
char *fmt,...)
127 va_start (args, fmt);
128 ortp_logv(ORTP_ERROR, fmt, args);
132static 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_handler(OrtpLogFunc func)
Definition: logging.c:43
ORTP_PUBLIC void ortp_set_log_level_mask(int levelmask)
Definition: logging.c:54
ORTP_PUBLIC void ortp_set_log_file(FILE *file)
Definition: logging.c:30