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 ORTP_PUBLIC
void ortp_logv(
int level,
const char *fmt, va_list args);
65 ORTP_PUBLIC
int ortp_get_log_level_mask(
void);
75 #define CHECK_FORMAT_ARGS(m,n) __attribute__((format(printf,m,n)))
77 #define CHECK_FORMAT_ARGS(m,n)
81 #pragma GCC diagnostic ignored "-Wunused-function"
83 #ifdef ORTP_DEBUG_MODE
84 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_debug(const
char *fmt,...)
88 ortp_logv(ORTP_DEBUG, fmt, args);
93 #define ortp_debug(...)
97 #ifdef ORTP_NOMESSAGE_MODE
100 #define ortp_message(...)
101 #define ortp_warning(...)
105 static ORTP_INLINE
void CHECK_FORMAT_ARGS(2,3) ortp_log(OrtpLogLevel lev, const
char *fmt,...) {
107 va_start (args, fmt);
108 ortp_logv(lev, fmt, args);
112 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_message(const
char *fmt,...)
115 va_start (args, fmt);
116 ortp_logv(ORTP_MESSAGE, fmt, args);
120 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_warning(const
char *fmt,...)
123 va_start (args, fmt);
124 ortp_logv(ORTP_WARNING, fmt, args);
130 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_error(const
char *fmt,...)
133 va_start (args, fmt);
134 ortp_logv(ORTP_ERROR, fmt, args);
138 static ORTP_INLINE
void CHECK_FORMAT_ARGS(1,2) ortp_fatal(const
char *fmt,...)
141 va_start (args, fmt);
142 ortp_logv(ORTP_FATAL, fmt, args);
148 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:195
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:69
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:61