55 #define SPA_LOG_TOPIC_DEFAULT NULL
69 #define SPA_TYPE_INTERFACE_Log SPA_TYPE_INFO_INTERFACE_BASE "Log"
75 #define SPA_VERSION_LOG 0
94 #define SPA_VERSION_LOG_TOPIC 0
107 #define SPA_VERSION_LOG_METHODS 1
124 void (*
log) (
void *object,
213 #define SPA_LOG_TOPIC(v, t) \
214 (struct spa_log_topic){ .version = v, .topic = (t)}
216 #define spa_log_topic_init(l, topic) \
218 struct spa_log *_l = l; \
219 if (SPA_LIKELY(_l)) { \
220 struct spa_interface *_if = &_l->iface; \
221 spa_interface_call(_if, struct spa_log_methods, \
222 topic_init, 1, topic); \
227 #define spa_log_level_enabled(l,lev) ((l) && (l)->level >= (lev))
229 #define spa_log_level_topic_enabled(l,topic,lev) \
231 struct spa_log *_log = l; \
232 enum spa_log_level _lev = _log ? _log->level : SPA_LOG_LEVEL_NONE; \
233 struct spa_log_topic *_t = (struct spa_log_topic *)topic; \
234 if (_t && _t->has_custom_level) \
240 #define spa_log_logt(l,lev,topic,...) \
242 struct spa_log *_l = l; \
243 struct spa_interface *_if = &_l->iface; \
244 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \
245 if (spa_interface_callback_version_min( \
246 _if, struct spa_log_methods, 1)) \
247 spa_interface_call(_if, \
248 struct spa_log_methods, logt, 1, \
252 spa_interface_call(_if, \
253 struct spa_log_methods, log, 0, \
259 #define spa_log_logtv(l,lev,topic,...) \
261 struct spa_log *_l = l; \
262 struct spa_interface *_if = &_l->iface; \
263 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \
264 if (spa_interface_callback_version_min( \
265 _if, struct spa_log_methods, 1)) \
266 spa_interface_call(_if, \
267 struct spa_log_methods, logtv, 1, \
271 spa_interface_call(_if, \
272 struct spa_log_methods, logv, 0, \
277 #define spa_log_log(l,lev,...) \
278 spa_log_logt(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
280 #define spa_log_logv(l,lev,...) \
281 spa_log_logtv(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
283 #define spa_log_error(l,...) spa_log_log(l,SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
284 #define spa_log_warn(l,...) spa_log_log(l,SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
285 #define spa_log_info(l,...) spa_log_log(l,SPA_LOG_LEVEL_INFO,__FILE__,__LINE__,__func__,__VA_ARGS__)
286 #define spa_log_debug(l,...) spa_log_log(l,SPA_LOG_LEVEL_DEBUG,__FILE__,__LINE__,__func__,__VA_ARGS__)
287 #define spa_log_trace(l,...) spa_log_log(l,SPA_LOG_LEVEL_TRACE,__FILE__,__LINE__,__func__,__VA_ARGS__)
289 #define spa_logt_error(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_ERROR,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
290 #define spa_logt_warn(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_WARN,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
291 #define spa_logt_info(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_INFO,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
292 #define spa_logt_debug(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_DEBUG,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
293 #define spa_logt_trace(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_TRACE,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
296 #define spa_log_trace_fp(l,...) spa_log_log(l,SPA_LOG_LEVEL_TRACE,__FILE__,__LINE__,__func__,__VA_ARGS__)
298 #define spa_log_trace_fp(l,...)
304 #define SPA_KEY_LOG_LEVEL "log.level"
305 #define SPA_KEY_LOG_COLORS "log.colors"
306 #define SPA_KEY_LOG_FILE "log.file"
308 #define SPA_KEY_LOG_TIMESTAMP "log.timestamp"
309 #define SPA_KEY_LOG_LINE "log.line"
310 #define SPA_KEY_LOG_PATTERNS "log.patterns"
spa_log_level
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:57
@ SPA_LOG_LEVEL_INFO
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:61
@ SPA_LOG_LEVEL_NONE
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:58
@ SPA_LOG_LEVEL_TRACE
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:63
@ SPA_LOG_LEVEL_DEBUG
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:62
@ SPA_LOG_LEVEL_ERROR
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:59
@ SPA_LOG_LEVEL_WARN
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:60
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:211
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:106
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: obj-x86_64-linux-gnu/doc/spa/support/log.h:170
uint32_t version
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:108
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: obj-x86_64-linux-gnu/doc/spa/support/log.h:209
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: obj-x86_64-linux-gnu/doc/spa/support/log.h:146
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: obj-x86_64-linux-gnu/doc/spa/support/log.h:124
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: obj-x86_64-linux-gnu/doc/spa/support/log.h:195
Identifier for a topic.
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:93
uint32_t version
the version of this topic.
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:97
bool has_custom_level
False if this topic follows the SPA Logging level.
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:103
enum spa_log_level level
Logging level set for this topic.
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:101
const char * topic
The string identifier for the topic.
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:99
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:72
struct spa_interface iface
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:76
enum spa_log_level level
Logging level, everything above this level is not logged.
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:80