20 #ifndef __PIPEWIRE_LOG_H__
21 #define __PIPEWIRE_LOG_H__
23 #include <spa/support/log.h>
51 int line,
const char *func,
52 const char *fmt, ...) SPA_PRINTF_FUNC(5, 6);
57 int line, const
char *func,
58 const
char *fmt, va_list args) SPA_PRINTF_FUNC(5, 0);
62 #define pw_log_level_enabled(lev) (pw_log_level >= (lev))
64 #if defined(__USE_ISOC11) || defined(__USE_ISOC99) || \
65 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
67 #define pw_log_logc(lev,...) \
69 if (SPA_UNLIKELY(pw_log_level_enabled (lev))) \
70 pw_log_log(lev,__VA_ARGS__); \
73 #define pw_log_error(...) pw_log_logc(SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
74 #define pw_log_warn(...) pw_log_logc(SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
75 #define pw_log_info(...) pw_log_logc(SPA_LOG_LEVEL_INFO,__FILE__,__LINE__,__func__,__VA_ARGS__)
76 #define pw_log_debug(...) pw_log_logc(SPA_LOG_LEVEL_DEBUG,__FILE__,__LINE__,__func__,__VA_ARGS__)
77 #define pw_log_trace(...) pw_log_logc(SPA_LOG_LEVEL_TRACE,__FILE__,__LINE__,__func__,__VA_ARGS__)
83 #define PW_LOG_FUNC(name,lev) \
84 static inline void pw_log_##name (const char *format, ...) \
86 if (SPA_UNLIKELY(pw_log_level_enabled(lev))) { \
88 va_start(varargs, format); \
89 pw_log_logv(lev,__FILE__,__LINE__,__func__,format,varargs); \
#define PW_LOG_FUNC(name, lev)
Definition: log.h:83
SPA_EXPORT void pw_log_set_level(enum spa_log_level level)
Set the global log level.
Definition: log.c:55
SPA_EXPORT void pw_log_log(enum spa_log_level level, const char *file, int line, const char *func, const char *fmt,...)
Log a message.
Definition: log.c:74
SPA_EXPORT struct spa_log * pw_log_get(void)
Get the global log interface.
Definition: log.c:45
SPA_EXPORT void pw_log_logv(enum spa_log_level level, const char *file, int line, const char *func, const char *fmt, va_list args)
Log a message with va_list.
Definition: log.c:100
SPA_EXPORT void pw_log_set(struct spa_log *log)
Set the global log interface.
Definition: log.c:33
enum spa_log_level pw_log_level
The global log level.
Definition: log.c:24