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);
51 ORTP_PUBLIC OrtpLogFunc ortp_get_log_handler();
53 ORTP_VAR_PUBLIC OrtpLogFunc ortp_logv_out;
55 #define ortp_log_level_enabled(level) (ortp_get_log_level_mask() & (level)) 57 ORTP_PUBLIC
void ortp_logv(
int level,
const char *fmt, va_list args);
66 ORTP_PUBLIC
int ortp_get_log_level_mask(
void);
76 #define CHECK_FORMAT_ARGS(m,n) __attribute__((format(printf,m,n))) 78 #define CHECK_FORMAT_ARGS(m,n) 82 #pragma GCC diagnostic ignored "-Wunused-function" 84 #ifdef ORTP_DEBUG_MODE 85 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_debug(const
char *fmt,...)
89 ortp_logv(ORTP_DEBUG, fmt, args);
94 #define ortp_debug(...) 98 #ifdef ORTP_NOMESSAGE_MODE 100 #define ortp_log(...) 101 #define ortp_message(...) 102 #define ortp_warning(...) 106 static ORTP_INLINE
void CHECK_FORMAT_ARGS(2,3) ortp_log(OrtpLogLevel lev, const
char *fmt,...) {
108 va_start (args, fmt);
109 ortp_logv(lev, fmt, args);
113 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_message(const
char *fmt,...)
116 va_start (args, fmt);
117 ortp_logv(ORTP_MESSAGE, fmt, args);
121 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_warning(const
char *fmt,...)
124 va_start (args, fmt);
125 ortp_logv(ORTP_WARNING, fmt, args);
131 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_error(const
char *fmt,...)
134 va_start (args, fmt);
135 ortp_logv(ORTP_ERROR, fmt, args);
139 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_fatal(const
char *fmt,...)
142 va_start (args, fmt);
143 ortp_logv(ORTP_FATAL, fmt, args);
149 void ortp_qnx_log_handler(
const char *domain, OrtpLogLevel lev,
const char *fmt, va_list args);
ORTP_PUBLIC void ortp_logv_flush(void)
Definition: logging.c:197
ORTP_PUBLIC void ortp_set_log_file(FILE *file)
Definition: logging.c:37
ORTP_PUBLIC void ortp_set_log_thread_id(unsigned long thread_id)
Definition: logging.c:72
ORTP_PUBLIC void ortp_set_log_handler(OrtpLogFunc func)
Definition: logging.c:50
ORTP_PUBLIC void ortp_set_log_level_mask(int levelmask)
Definition: logging.c:64