Go to the documentation of this file.
25 #ifndef PIPEWIRE_LOG_H
26 #define PIPEWIRE_LOG_H
68 int line,
const char *func,
76 int line, const
char *func,
85 int line, const
char *func,
92 int line, const
char *func,
117 #define PW_LOG_TOPIC_STATIC(var, topic) \
118 static struct spa_log_topic var##__LINE__ = SPA_LOG_TOPIC(0, topic); \
119 static struct spa_log_topic *var = &(var##__LINE__)
125 #define PW_LOG_TOPIC_EXTERN(var) \
126 extern struct spa_log_topic *var
132 #define PW_LOG_TOPIC(var, topic) \
133 struct spa_log_topic var##__LINE__ = SPA_LOG_TOPIC(0, topic); \
134 struct spa_log_topic *var = &(var##__LINE__)
136 #define PW_LOG_TOPIC_INIT(var) \
137 spa_log_topic_init(pw_log_get(), var);
140 #define pw_log_level_enabled(lev) (pw_log_level >= (lev))
141 #define pw_log_topic_enabled(lev,t) ((t) && (t)->has_custom_level ? (t)->level >= (lev) : pw_log_level_enabled((lev)))
144 #define pw_logt(lev,topic,...) \
146 if (SPA_UNLIKELY(pw_log_topic_enabled(lev,topic))) \
147 pw_log_logt(lev,topic,__FILE__,__LINE__,__func__,__VA_ARGS__); \
150 #define pw_log(lev,...) pw_logt(lev,PW_LOG_TOPIC_DEFAULT,__VA_ARGS__)
152 #define pw_log_error(...) pw_log(SPA_LOG_LEVEL_ERROR,__VA_ARGS__)
153 #define pw_log_warn(...) pw_log(SPA_LOG_LEVEL_WARN,__VA_ARGS__)
154 #define pw_log_info(...) pw_log(SPA_LOG_LEVEL_INFO,__VA_ARGS__)
155 #define pw_log_debug(...) pw_log(SPA_LOG_LEVEL_DEBUG,__VA_ARGS__)
156 #define pw_log_trace(...) pw_log(SPA_LOG_LEVEL_TRACE,__VA_ARGS__)
158 #define pw_logt_error(t,...) pw_logt(SPA_LOG_LEVEL_ERROR,t,__VA_ARGS__)
159 #define pw_logt_warn(t,...) pw_logt(SPA_LOG_LEVEL_WARN,t,__VA_ARGS__)
160 #define pw_logt_info(t,...) pw_logt(SPA_LOG_LEVEL_INFO,t,__VA_ARGS__)
161 #define pw_logt_debug(t,...) pw_logt(SPA_LOG_LEVEL_DEBUG,t,__VA_ARGS__)
162 #define pw_logt_trace(t,...) pw_logt(SPA_LOG_LEVEL_TRACE,t,__VA_ARGS__)
165 #define pw_log_trace_fp(...) pw_log(SPA_LOG_LEVEL_TRACE,__VA_ARGS__)
167 #define pw_log_trace_fp(...)
enum spa_log_level pw_log_level
The global log level.
Definition: log.c:43
@ SPA_TYPE_None
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:45
#define spa_log_logtv(l, lev, topic,...)
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:259
uint32_t width
Definition: defs.h:87
@ SPA_TYPE_Float
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:50
#define SPA_POD_CHOICE_BODY_FOREACH(body, _size, iter)
Definition: iter.h:102
@ SPA_TYPE_Long
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:49
PW_LOG_TOPIC_STATIC(log_topic, "pw.log")
uint32_t type
one of enum spa_type
Definition: pod/pod.h:170
const struct spa_type_info spa_type_control[]
Definition: control/type-info.h:45
const struct spa_type_info spa_type_choice[]
Definition: utils/type-info.h:69
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:93
spa_log_level
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:57
@ SPA_TYPE_Id
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:47
uint32_t type
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:138
uint32_t unit
Definition: pod/pod.h:227
@ SPA_TYPE_Int
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:48
#define PW_LOG_TOPIC_INIT(var)
Definition: src/pipewire/log.h:136
Definition: pod/pod.h:180
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:137
Definition: pod/pod.h:169
Definition: pod/pod.h:199
uint32_t id
id of the object, depends on the object type
Definition: pod/pod.h:171
void pw_log_logt(enum spa_log_level level, const struct spa_log_topic *topic, const char *file, int line, const char *func, const char *fmt,...)
Log a message for the given topic.
Definition: log.c:114
#define SPA_EXPORT
Definition: defs.h:215
Definition: pod/pod.h:219
uint32_t height
Definition: defs.h:88
struct spa_pod child
Definition: pod/pod.h:151
@ SPA_TYPE_Array
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:57
#define SPA_POD_OBJECT_BODY_FOREACH(body, size, iter)
Definition: iter.h:118
#define SPA_POD_TYPE(pod)
Definition: pod/pod.h:41
@ SPA_TYPE_Rectangle
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:54
const void * value
Definition: pod/pod.h:183
Definition: pod/pod.h:148
SPA_LOG_IMPL(default_log)
#define DEFAULT_LOG_LEVEL
Definition: log.c:40
enum spa_log_level level
Definition: log.c:225
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:211
#define SPA_POD_ARRAY_BODY_FOREACH(body, _size, iter)
Definition: iter.h:94
void void pw_log_logtv(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(6
Log a message for a topic.
#define _log(_c, fmt,...)
Definition: log.c:231
@ SPA_TYPE_Pointer
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:61
Definition: pod/pod.h:226
const char * name
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:140
void pw_log_log_object(enum spa_log_level level, const char *file, int line, const char *func, uint32_t flags, const void *object)
Definition: log.c:389
#define pw_log_topic_enabled(lev, t)
Definition: src/pipewire/log.h:141
@ SPA_TYPE_Fd
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:62
const char * func
Definition: log.c:228
PW_LOG_TOPIC(log_conf, "pw.conf")
void _pw_log_topic_new(struct spa_log_topic *topic)
Initialize the log topic.
Definition: log.c:411
@ SPA_TYPE_String
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:52
@ SPA_TYPE_Bitmap
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:56
uint32_t type
type of control, enum spa_control_type
Definition: pod/pod.h:221
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:72
void pw_log_logv(enum spa_log_level level, const char *file, int line, const char *func, const char *fmt, va_list args)
Log a message for the default topic with va_list.
Definition: log.c:164
@ SPA_TYPE_Bool
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:46
Definition: pod/pod.h:122
uint32_t type
pointer id, one of enum spa_type
Definition: pod/pod.h:181
#define SPA_POD_SEQUENCE_BODY_FOREACH(body, size, iter)
Definition: iter.h:126
enum spa_log_level level
Logging level, everything above this level is not logged.
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:80
#define SPA_POD_BODY(pod)
Definition: pod/pod.h:47
uint32_t key
key of property, list of valid keys depends on the object type
Definition: pod/pod.h:200
void void void void pw_log_logv(enum spa_log_level level, const char *file, int line, const char *func, const char *fmt, va_list args) 1(5
Log a message for the default topic.
uint32_t size
Definition: pod/pod.h:51
#define SPA_TYPE_ROOT
Definition: utils/type-info.h:40
@ SPA_TYPE_Bytes
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:53
@ SPA_TYPE_Double
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:51
#define SPA_POD_BODY_SIZE(pod)
Definition: pod/pod.h:40
@ SPA_TYPE_Object
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:59
struct spa_log_topic * PW_LOG_TOPIC_DEFAULT
Definition: log.c:48
@ SPA_TYPE_Sequence
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:60
const struct spa_type_info * values
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:141
struct spa_pod value
control value, depends on type
Definition: pod/pod.h:222
uint32_t denom
Definition: defs.h:106
uint32_t type
type of choice, one of enum spa_choice_type
Definition: pod/pod.h:149
const char * file
Definition: log.c:226
#define spa_log_topic_init(l, topic)
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:216
void pw_log_init(void)
Definition: log.c:417
@ SPA_TYPE_Fraction
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:55
void void void pw_log_log(enum spa_log_level level, const char *file, int line, const char *func, const char *fmt,...) 1(5
Log a message for the default topic.
void pw_log_set_level(enum spa_log_level level)
Set the global log level.
Definition: log.c:96
uint32_t type
Definition: pod/pod.h:52
struct spa_log * pw_log_get(void)
Get the global log interface.
Definition: log.c:87
bool pw_log_is_default(void)
Definition: log.c:78
void pw_log_log(enum spa_log_level level, const char *file, int line, const char *func, const char *fmt,...)
Log a message for the default topic.
Definition: log.c:185
const struct spa_type_info * spa_debug_type_find(const struct spa_type_info *info, uint32_t type)
Definition: types.h:41
uint32_t flags
flags for property
Definition: pod/pod.h:211
@ SPA_TYPE_Choice
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:63
void pw_log_logt(enum spa_log_level level, const struct spa_log_topic *topic, const char *file, int line, const char *func, const char *fmt,...) 1(6
Log a message for a topic.
void pw_log_logtv(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)
Log a message for the given topic with va_list.
Definition: log.c:141
#define SPA_POD_CONTENTS(type, pod)
Definition: pod/pod.h:45
struct spa_pod value
Definition: pod/pod.h:212
uint32_t num
Definition: defs.h:105
uint32_t flags
extra flags
Definition: pod/pod.h:150
void pw_log_set(struct spa_log *log)
Set the global log interface.
Definition: log.c:72
#define SPA_POD_FOREACH(pod, size, iter)
Definition: iter.h:110
#define SPA_UNLIKELY(x)
Definition: defs.h:242
uint32_t offset
media offset
Definition: pod/pod.h:220
int line
Definition: log.c:227
struct spa_pod child
Definition: pod/pod.h:123
@ SPA_TYPE_Struct
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:58
const char * spa_debug_type_find_name(const struct spa_type_info *info, uint32_t type)
Definition: types.h:68