56#define SPA_LOG_TOPIC_DEFAULT NULL
70#define SPA_TYPE_INTERFACE_Log SPA_TYPE_INFO_INTERFACE_BASE "Log"
76#define SPA_VERSION_LOG 0
95#define SPA_VERSION_LOG_TOPIC 0
108#define SPA_VERSION_LOG_METHODS 1
125 void (*
log) (
void *object,
147 void (*
logv) (
void *object,
171 void (*
logt) (
void *object,
196 void (*
logtv) (
void *object,
214#define SPA_LOG_TOPIC(v, t) \
215 (struct spa_log_topic){ .version = (v), .topic = (t)}
217#define spa_log_topic_init(l, topic) \
219 struct spa_log *_l = l; \
220 if (SPA_LIKELY(_l)) { \
221 struct spa_interface *_if = &_l->iface; \
222 spa_interface_call(_if, struct spa_log_methods, \
223 topic_init, 1, topic); \
228#define spa_log_level_enabled(l,lev) ((l) && (l)->level >= (lev))
230#define spa_log_level_topic_enabled(l,topic,lev) \
232 struct spa_log *_log = l; \
233 enum spa_log_level _lev = _log ? _log->level : SPA_LOG_LEVEL_NONE; \
234 struct spa_log_topic *_t = (struct spa_log_topic *)(topic); \
235 if (_t && _t->has_custom_level) \
241#define spa_log_logt(l,lev,topic,...) \
243 struct spa_log *_l = l; \
244 struct spa_interface *_if = &_l->iface; \
245 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \
246 if (!spa_interface_call(_if, \
247 struct spa_log_methods, logt, 1, \
250 spa_interface_call(_if, \
251 struct spa_log_methods, log, 0, \
257#define spa_log_logtv(l,lev,topic,...) \
259 struct spa_log *_l = l; \
260 struct spa_interface *_if = &_l->iface; \
261 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \
262 if (!spa_interface_call(_if, \
263 struct spa_log_methods, logtv, 1, \
266 spa_interface_call(_if, \
267 struct spa_log_methods, logv, 0, \
272#define spa_logt_lev(l,lev,t,...) \
273 spa_log_logt(l,lev,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
275#define spa_log_lev(l,lev,...) \
276 spa_logt_lev(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
278#define spa_log_log(l,lev,...) \
279 spa_log_logt(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
281#define spa_log_logv(l,lev,...) \
282 spa_log_logtv(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
284#define spa_log_error(l,...) spa_log_lev(l,SPA_LOG_LEVEL_ERROR,__VA_ARGS__)
285#define spa_log_warn(l,...) spa_log_lev(l,SPA_LOG_LEVEL_WARN,__VA_ARGS__)
286#define spa_log_info(l,...) spa_log_lev(l,SPA_LOG_LEVEL_INFO,__VA_ARGS__)
287#define spa_log_debug(l,...) spa_log_lev(l,SPA_LOG_LEVEL_DEBUG,__VA_ARGS__)
288#define spa_log_trace(l,...) spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__)
290#define spa_logt_error(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_ERROR,t,__VA_ARGS__)
291#define spa_logt_warn(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_WARN,t,__VA_ARGS__)
292#define spa_logt_info(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_INFO,t,__VA_ARGS__)
293#define spa_logt_debug(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_DEBUG,t,__VA_ARGS__)
294#define spa_logt_trace(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_TRACE,t,__VA_ARGS__)
297#define spa_log_trace_fp(l,...) spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__)
299#define spa_log_trace_fp(l,...)
306#define SPA_KEY_LOG_LEVEL "log.level"
307#define SPA_KEY_LOG_COLORS "log.colors"
308#define SPA_KEY_LOG_FILE "log.file"
310#define SPA_KEY_LOG_TIMESTAMP "log.timestamp"
311#define SPA_KEY_LOG_LINE "log.line"
312#define SPA_KEY_LOG_PATTERNS "log.patterns"
spa_log_level
Definition: spa/include/spa/support/log.h:65
@ SPA_LOG_LEVEL_INFO
Definition: spa/include/spa/support/log.h:69
@ SPA_LOG_LEVEL_NONE
Definition: spa/include/spa/support/log.h:66
@ SPA_LOG_LEVEL_TRACE
Definition: spa/include/spa/support/log.h:71
@ SPA_LOG_LEVEL_DEBUG
Definition: spa/include/spa/support/log.h:70
@ SPA_LOG_LEVEL_ERROR
Definition: spa/include/spa/support/log.h:67
@ SPA_LOG_LEVEL_WARN
Definition: spa/include/spa/support/log.h:68
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:289
Definition: spa/include/spa/support/log.h:117
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:182
uint32_t version
Definition: spa/include/spa/support/log.h:120
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:221
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:158
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:136
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:207
Identifier for a topic.
Definition: spa/include/spa/support/log.h:103
uint32_t version
the version of this topic.
Definition: spa/include/spa/support/log.h:108
bool has_custom_level
False if this topic follows the Log level.
Definition: spa/include/spa/support/log.h:114
enum spa_log_level level
Logging level set for this topic.
Definition: spa/include/spa/support/log.h:112
const char * topic
The string identifier for the topic.
Definition: spa/include/spa/support/log.h:110
Definition: spa/include/spa/support/log.h:81
struct spa_interface iface
Definition: spa/include/spa/support/log.h:86
enum spa_log_level level
Logging level, everything above this level is not logged.
Definition: spa/include/spa/support/log.h:90