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)}
197 #define spa_log_topic_init(l, topic) \
199 struct spa_log *_l = l; \
200 if (SPA_LIKELY(_l)) { \
201 struct spa_interface *_if = &_l->iface; \
202 spa_interface_call(_if, struct spa_log_methods, \
203 topic_init, 1, topic); \
208 #define spa_log_level_enabled(l,lev) ((l) && (l)->level >= (lev))
210 #define spa_log_level_topic_enabled(l,topic,lev) \
212 struct spa_log *_log = l; \
213 enum spa_log_level _lev = _log ? _log->level : SPA_LOG_LEVEL_NONE; \
214 struct spa_log_topic *_t = (struct spa_log_topic *)(topic); \
215 if (_t && _t->has_custom_level) \
221 #define spa_log_logt(l,lev,topic,...) \
223 struct spa_log *_l = l; \
224 struct spa_interface *_if = &_l->iface; \
225 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \
226 if (!spa_interface_call(_if, \
227 struct spa_log_methods, logt, 1, \
230 spa_interface_call(_if, \
231 struct spa_log_methods, log, 0, \
237 #define spa_log_logtv(l,lev,topic,...) \
239 struct spa_log *_l = l; \
240 struct spa_interface *_if = &_l->iface; \
241 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \
242 if (!spa_interface_call(_if, \
243 struct spa_log_methods, logtv, 1, \
246 spa_interface_call(_if, \
247 struct spa_log_methods, logv, 0, \
252 #define spa_logt_lev(l,lev,t,...) \
253 spa_log_logt(l,lev,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
255 #define spa_log_lev(l,lev,...) \
256 spa_logt_lev(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
258 #define spa_log_log(l,lev,...) \
259 spa_log_logt(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
261 #define spa_log_logv(l,lev,...) \
262 spa_log_logtv(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
264 #define spa_log_error(l,...) spa_log_lev(l,SPA_LOG_LEVEL_ERROR,__VA_ARGS__)
265 #define spa_log_warn(l,...) spa_log_lev(l,SPA_LOG_LEVEL_WARN,__VA_ARGS__)
266 #define spa_log_info(l,...) spa_log_lev(l,SPA_LOG_LEVEL_INFO,__VA_ARGS__)
267 #define spa_log_debug(l,...) spa_log_lev(l,SPA_LOG_LEVEL_DEBUG,__VA_ARGS__)
268 #define spa_log_trace(l,...) spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__)
270 #define spa_logt_error(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_ERROR,t,__VA_ARGS__)
271 #define spa_logt_warn(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_WARN,t,__VA_ARGS__)
272 #define spa_logt_info(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_INFO,t,__VA_ARGS__)
273 #define spa_logt_debug(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_DEBUG,t,__VA_ARGS__)
274 #define spa_logt_trace(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_TRACE,t,__VA_ARGS__)
277 #define spa_log_trace_fp(l,...) spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__)
279 #define spa_log_trace_fp(l,...)
286 #define SPA_KEY_LOG_LEVEL "log.level"
287 #define SPA_KEY_LOG_COLORS "log.colors"
288 #define SPA_KEY_LOG_FILE "log.file"
290 #define SPA_KEY_LOG_TIMESTAMP "log.timestamp"
291 #define SPA_KEY_LOG_LINE "log.line"
292 #define SPA_KEY_LOG_PATTERNS "log.patterns"
spa_log_level
Definition: spa/include/spa/support/log.h:45
@ 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
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