36#define SPA_LOG_TOPIC_DEFAULT NULL
50#define SPA_TYPE_INTERFACE_Log SPA_TYPE_INFO_INTERFACE_BASE "Log"
56#define SPA_VERSION_LOG 0
75#define SPA_VERSION_LOG_TOPIC 0
88#define SPA_VERSION_LOG_METHODS 1
105 void (*
log) (
void *object,
127 void (*
logv) (
void *object,
151 void (*
logt) (
void *object,
176 void (*
logtv) (
void *object,
194#define SPA_LOG_TOPIC(v, t) \
195 (struct spa_log_topic){ .version = (v), .topic = (t)}
212 max_level =
topic->level;
214 max_level = log->
level;
218 return level <= max_level;
222#define spa_log_logt(l,lev,topic,...) \
224 struct spa_log *_l = l; \
225 struct spa_interface *_if = &_l->iface; \
226 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \
227 if (!spa_interface_call(_if, \
228 struct spa_log_methods, logt, 1, \
231 spa_interface_call(_if, \
232 struct spa_log_methods, log, 0, \
238#define spa_log_logtv(l,lev,topic,...) \
240 struct spa_log *_l = l; \
241 struct spa_interface *_if = &_l->iface; \
242 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \
243 if (!spa_interface_call(_if, \
244 struct spa_log_methods, logtv, 1, \
247 spa_interface_call(_if, \
248 struct spa_log_methods, logv, 0, \
253#define spa_logt_lev(l,lev,t,...) \
254 spa_log_logt(l,lev,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
256#define spa_log_lev(l,lev,...) \
257 spa_logt_lev(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
259#define spa_log_log(l,lev,...) \
260 spa_log_logt(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
262#define spa_log_logv(l,lev,...) \
263 spa_log_logtv(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
265#define spa_log_error(l,...) spa_log_lev(l,SPA_LOG_LEVEL_ERROR,__VA_ARGS__)
266#define spa_log_warn(l,...) spa_log_lev(l,SPA_LOG_LEVEL_WARN,__VA_ARGS__)
267#define spa_log_info(l,...) spa_log_lev(l,SPA_LOG_LEVEL_INFO,__VA_ARGS__)
268#define spa_log_debug(l,...) spa_log_lev(l,SPA_LOG_LEVEL_DEBUG,__VA_ARGS__)
269#define spa_log_trace(l,...) spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__)
271#define spa_logt_error(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_ERROR,t,__VA_ARGS__)
272#define spa_logt_warn(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_WARN,t,__VA_ARGS__)
273#define spa_logt_info(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_INFO,t,__VA_ARGS__)
274#define spa_logt_debug(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_DEBUG,t,__VA_ARGS__)
275#define spa_logt_trace(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_TRACE,t,__VA_ARGS__)
278#define spa_log_trace_fp(l,...) spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__)
280#define spa_log_trace_fp(l,...)
287#define SPA_KEY_LOG_LEVEL "log.level"
288#define SPA_KEY_LOG_COLORS "log.colors"
290#define SPA_KEY_LOG_FILE "log.file"
292#define SPA_KEY_LOG_TIMESTAMP "log.timestamp"
293#define SPA_KEY_LOG_LINE "log.line"
294#define SPA_KEY_LOG_PATTERNS "log.patterns"
#define spa_interface_call(iface, method_type, method, vers,...)
Invoke method named method in the callbacks on the given interface object.
Definition: hook.h:238
spa_log_level
Definition: spa/include/spa/support/log.h:45
static void spa_log_topic_init(struct spa_log *log, struct spa_log_topic *topic)
Definition: spa/include/spa/support/log.h:208
static bool spa_log_level_topic_enabled(const struct spa_log *log, const struct spa_log_topic *topic, enum spa_log_level level)
Definition: spa/include/spa/support/log.h:216
@ SPA_LOG_LEVEL_INFO
Definition: spa/include/spa/support/log.h:49
@ SPA_LOG_LEVEL_NONE
Definition: spa/include/spa/support/log.h:46
@ SPA_LOG_LEVEL_TRACE
Definition: spa/include/spa/support/log.h:51
@ SPA_LOG_LEVEL_DEBUG
Definition: spa/include/spa/support/log.h:50
@ SPA_LOG_LEVEL_ERROR
Definition: spa/include/spa/support/log.h:47
@ SPA_LOG_LEVEL_WARN
Definition: spa/include/spa/support/log.h:48
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:273
#define SPA_UNLIKELY(x)
Definition: defs.h:347
Definition: spa/include/spa/support/log.h:97
void(*) void(*) void(* logt)(void *object, enum spa_log_level level, const struct spa_log_topic *topic, const char *file, int line, const char *func, const char *fmt,...) 1(7
Log a message with the given log level for the given topic.
Definition: spa/include/spa/support/log.h:162
uint32_t version
Definition: spa/include/spa/support/log.h:100
void(*) void(*) void(*) void(*) void(* topic_init)(void *object, struct spa_log_topic *topic)
Initializes a spa_log_topic to the correct logging level.
Definition: spa/include/spa/support/log.h:201
void(*) void(* logv)(void *object, enum spa_log_level level, const char *file, int line, const char *func, const char *fmt, va_list args) 1(6
Log a message with the given log level.
Definition: spa/include/spa/support/log.h:138
void(* log)(void *object, enum spa_log_level level, const char *file, int line, const char *func, const char *fmt,...) 1(6
Log a message with the given log level.
Definition: spa/include/spa/support/log.h:116
void(*) void(*) void(*) void(* logtv)(void *object, enum spa_log_level level, const struct spa_log_topic *topic, const char *file, int line, const char *func, const char *fmt, va_list args) 1(7
Log a message with the given log level for the given topic.
Definition: spa/include/spa/support/log.h:187
Identifier for a topic.
Definition: spa/include/spa/support/log.h:83
uint32_t version
the version of this topic.
Definition: spa/include/spa/support/log.h:88
bool has_custom_level
False if this topic follows the Log level.
Definition: spa/include/spa/support/log.h:94
enum spa_log_level level
Logging level set for this topic.
Definition: spa/include/spa/support/log.h:92
const char * topic
The string identifier for the topic.
Definition: spa/include/spa/support/log.h:90
Definition: spa/include/spa/support/log.h:61
struct spa_interface iface
Definition: spa/include/spa/support/log.h:66
enum spa_log_level level
Logging level, everything above this level is not logged.
Definition: spa/include/spa/support/log.h:70