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)} 215 max_level =
topic->level;
217 max_level = log->
level;
219 return level <= max_level;
223 #define spa_log_logt(l,lev,topic,...) \ 225 struct spa_log *_l = l; \ 226 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \ 227 struct spa_interface *_if = &_l->iface; \ 228 if (!spa_interface_call(_if, \ 229 struct spa_log_methods, logt, 1, \ 232 spa_interface_call(_if, \ 233 struct spa_log_methods, log, 0, \ 239 #define spa_log_logtv(l,lev,topic,...) \ 241 struct spa_log *_l = l; \ 242 if (SPA_UNLIKELY(spa_log_level_topic_enabled(_l, topic, lev))) { \ 243 struct spa_interface *_if = &_l->iface; \ 244 if (!spa_interface_call(_if, \ 245 struct spa_log_methods, logtv, 1, \ 248 spa_interface_call(_if, \ 249 struct spa_log_methods, logv, 0, \ 254 #define spa_logt_lev(l,lev,t,...) \ 255 spa_log_logt(l,lev,t,__FILE__,__LINE__,__func__,__VA_ARGS__) 257 #define spa_log_lev(l,lev,...) \ 258 spa_logt_lev(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__) 260 #define spa_log_log(l,lev,...) \ 261 spa_log_logt(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__) 263 #define spa_log_logv(l,lev,...) \ 264 spa_log_logtv(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__) 266 #define spa_log_error(l,...) spa_log_lev(l,SPA_LOG_LEVEL_ERROR,__VA_ARGS__) 267 #define spa_log_warn(l,...) spa_log_lev(l,SPA_LOG_LEVEL_WARN,__VA_ARGS__) 268 #define spa_log_info(l,...) spa_log_lev(l,SPA_LOG_LEVEL_INFO,__VA_ARGS__) 269 #define spa_log_debug(l,...) spa_log_lev(l,SPA_LOG_LEVEL_DEBUG,__VA_ARGS__) 270 #define spa_log_trace(l,...) spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__) 272 #define spa_logt_error(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_ERROR,t,__VA_ARGS__) 273 #define spa_logt_warn(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_WARN,t,__VA_ARGS__) 274 #define spa_logt_info(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_INFO,t,__VA_ARGS__) 275 #define spa_logt_debug(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_DEBUG,t,__VA_ARGS__) 276 #define spa_logt_trace(l,t,...) spa_logt_lev(l,SPA_LOG_LEVEL_TRACE,t,__VA_ARGS__) 279 #define spa_log_trace_fp(l,...) spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__) 281 #define spa_log_trace_fp(l,...) 288 #define SPA_KEY_LOG_LEVEL "log.level" 289 #define SPA_KEY_LOG_COLORS "log.colors" 291 #define SPA_KEY_LOG_FILE "log.file" 293 #define SPA_KEY_LOG_TIMESTAMP "log.timestamp" 294 #define SPA_KEY_LOG_LINE "log.line" 295 #define SPA_KEY_LOG_PATTERNS "log.patterns"
enum spa_log_level level
Logging level set for this topic.
Definition: log.h:92
Identifier for a topic.
Definition: log.h:83
spa_log_level
Definition: log.h:45
struct spa_interface iface
Definition: log.h:66
uint32_t version
the version of this topic.
Definition: log.h:88
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:162
uint32_t version
Definition: log.h:100
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:116
#define SPA_UNLIKELY(x)
Definition: defs.h:347
#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
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:138
static bool spa_log_level_topic_enabled(const struct spa_log *log, const struct spa_log_topic *topic, enum spa_log_level level)
Definition: log.h:216
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:201
static void spa_log_topic_init(struct spa_log *log, struct spa_log_topic *topic)
Definition: log.h:208
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:187
bool has_custom_level
False if this topic follows the Log level.
Definition: log.h:94
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:273
const char * topic
The string identifier for the topic.
Definition: log.h:90
enum spa_log_level level
Logging level, everything above this level is not logged.
Definition: log.h:70