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_log_log(l,lev,...) \
273 spa_log_logt(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
275 #define spa_log_logv(l,lev,...) \
276 spa_log_logtv(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
278 #define spa_log_error(l,...) spa_log_log(l,SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
279 #define spa_log_warn(l,...) spa_log_log(l,SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
280 #define spa_log_info(l,...) spa_log_log(l,SPA_LOG_LEVEL_INFO,__FILE__,__LINE__,__func__,__VA_ARGS__)
281 #define spa_log_debug(l,...) spa_log_log(l,SPA_LOG_LEVEL_DEBUG,__FILE__,__LINE__,__func__,__VA_ARGS__)
282 #define spa_log_trace(l,...) spa_log_log(l,SPA_LOG_LEVEL_TRACE,__FILE__,__LINE__,__func__,__VA_ARGS__)
284 #define spa_logt_error(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_ERROR,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
285 #define spa_logt_warn(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_WARN,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
286 #define spa_logt_info(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_INFO,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
287 #define spa_logt_debug(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_DEBUG,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
288 #define spa_logt_trace(l,t,...) spa_log_logt(l,SPA_LOG_LEVEL_TRACE,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
291 #define spa_log_trace_fp(l,...) spa_log_log(l,SPA_LOG_LEVEL_TRACE,__FILE__,__LINE__,__func__,__VA_ARGS__)
293 #define spa_log_trace_fp(l,...)
299 #define SPA_KEY_LOG_LEVEL "log.level"
300 #define SPA_KEY_LOG_COLORS "log.colors"
301 #define SPA_KEY_LOG_FILE "log.file"
303 #define SPA_KEY_LOG_TIMESTAMP "log.timestamp"
304 #define SPA_KEY_LOG_LINE "log.line"
305 #define SPA_KEY_LOG_PATTERNS "log.patterns"
spa_log_level
Definition: log.h:65
@ SPA_LOG_LEVEL_INFO
Definition: log.h:69
@ SPA_LOG_LEVEL_NONE
Definition: log.h:66
@ SPA_LOG_LEVEL_TRACE
Definition: log.h:71
@ SPA_LOG_LEVEL_DEBUG
Definition: log.h:70
@ SPA_LOG_LEVEL_ERROR
Definition: log.h:67
@ SPA_LOG_LEVEL_WARN
Definition: log.h:68
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:260
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: log.h:182
uint32_t version
Definition: 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: 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: 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: 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: log.h:207
Identifier for a topic.
Definition: log.h:103
uint32_t version
the version of this topic.
Definition: log.h:108
bool has_custom_level
False if this topic follows the Log level.
Definition: log.h:114
enum spa_log_level level
Logging level set for this topic.
Definition: log.h:112
const char * topic
The string identifier for the topic.
Definition: log.h:110
struct spa_interface iface
Definition: log.h:86
enum spa_log_level level
Logging level, everything above this level is not logged.
Definition: log.h:90