25 #ifndef SPA_LOG_IMPL_H
26 #define SPA_LOG_IMPL_H
51 static const char *
const levels[] = {
"-",
"E",
"W",
"I",
"D",
"T" };
53 const char *basename = strrchr(file,
'/');
54 char text[512], location[1024];
55 char topicstr[32] = {0};
62 if (topic && topic->topic)
63 snprintf(topicstr,
sizeof(topicstr),
" %s ", topic->topic);
64 vsnprintf(text,
sizeof(text), fmt, args);
65 snprintf(location,
sizeof(location),
"[%s]%s[%s:%i %s()] %s\n",
68 basename, line, func, text);
69 fputs(location, stderr);
103 const
char *fmt, ...)
116 #define SPA_LOG_IMPL_DEFINE(name) \
118 struct spa_log log; \
119 struct spa_log_methods methods; \
122 #define SPA_LOG_IMPL_INIT(name) \
123 { { { SPA_TYPE_INTERFACE_Log, SPA_VERSION_LOG, \
124 SPA_CALLBACKS_INIT(&name.methods, &name) }, \
125 SPA_LOG_LEVEL_INFO, }, \
126 { SPA_VERSION_LOG_METHODS, \
130 spa_log_impl_logtv, \
133 #define SPA_LOG_IMPL(name) \
134 SPA_LOG_IMPL_DEFINE(name) = SPA_LOG_IMPL_INIT(name)
spa_log_level
Definition: log.h:65
static void spa_log_impl_log(void *object, enum spa_log_level level, const char *file, int line, const char *func, const char *fmt,...)
Definition: log-impl.h:103
static void spa_log_impl_topic_init(void *object, struct spa_log_topic *topic)
Definition: log-impl.h:116
static void spa_log_impl_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)
Definition: log-impl.h:47
static void spa_log_impl_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,...)
Definition: log-impl.h:77
static void spa_log_impl_logv(void *object, enum spa_log_level level, const char *file, int line, const char *func, const char *fmt, va_list args)
Definition: log-impl.h:91
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:260
Identifier for a topic.
Definition: log.h:103