PipeWire 0.3.51
Log

Logging interface More...

Files

file  log-impl.h
 spa/support/log-impl.h
 
file  log.h
 spa/support/log.h
 

Data Structures

struct  spa_log
 
struct  spa_log_topic
 Identifier for a topic. More...
 
struct  spa_log_methods
 

Macros

#define SPA_LOG_IMPL_DEFINE(name)
 
#define SPA_LOG_IMPL_INIT(name)
 
#define SPA_LOG_IMPL(name)
 
#define SPA_LOG_TOPIC_DEFAULT   NULL
 The default log topic.
 
#define SPA_TYPE_INTERFACE_Log   SPA_TYPE_INFO_INTERFACE_BASE "Log"
 The Log interface.
 
#define SPA_VERSION_LOG   0
 the version of this log.
 
#define SPA_VERSION_LOG_TOPIC   0
 
#define SPA_VERSION_LOG_METHODS   1
 
#define SPA_LOG_TOPIC(v, t)
 
#define spa_log_topic_init(l, topic)
 
#define spa_log_level_enabled(l, lev)
 
#define spa_log_level_topic_enabled(l, topic, lev)
 
#define spa_log_logt(l, lev, topic, ...)
 
#define spa_log_logtv(l, lev, topic, ...)
 
#define spa_log_log(l, lev, ...)
 
#define spa_log_logv(l, lev, ...)
 
#define spa_log_error(l, ...)
 
#define spa_log_warn(l, ...)
 
#define spa_log_info(l, ...)
 
#define spa_log_debug(l, ...)
 
#define spa_log_trace(l, ...)
 
#define spa_logt_error(l, t, ...)
 
#define spa_logt_warn(l, t, ...)
 
#define spa_logt_info(l, t, ...)
 
#define spa_logt_debug(l, t, ...)
 
#define spa_logt_trace(l, t, ...)
 
#define spa_log_trace_fp(l, ...)
 
#define SPA_KEY_LOG_LEVEL   "log.level"
 keys can be given when initializing the logger handle
 
#define SPA_KEY_LOG_COLORS   "log.colors"
 enable colors in the logger
 
#define SPA_KEY_LOG_FILE   "log.file"
 log to the specified file instead of stderr.
 
#define SPA_KEY_LOG_TIMESTAMP   "log.timestamp"
 log timestamps
 
#define SPA_KEY_LOG_LINE   "log.line"
 log file and line numbers
 
#define SPA_KEY_LOG_PATTERNS   "log.patterns"
 Spa:String:JSON array of [ {"pattern" : level}, ... ].
 

Enumerations

enum  spa_log_level {
  SPA_LOG_LEVEL_NONE = 0 , SPA_LOG_LEVEL_ERROR , SPA_LOG_LEVEL_WARN , SPA_LOG_LEVEL_INFO ,
  SPA_LOG_LEVEL_DEBUG , SPA_LOG_LEVEL_TRACE
}
 

Functions

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)
 
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,...)
 
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)
 
static void spa_log_impl_log (void *object, enum spa_log_level level, const char *file, int line, const char *func, const char *fmt,...)
 
static void spa_log_impl_topic_init (void *object, struct spa_log_topic *topic)
 

Detailed Description

Logging interface

Macro Definition Documentation

◆ SPA_LOG_IMPL_DEFINE

#define SPA_LOG_IMPL_DEFINE ( name)

◆ SPA_LOG_IMPL_INIT

#define SPA_LOG_IMPL_INIT ( name)

◆ SPA_LOG_IMPL

#define SPA_LOG_IMPL ( name)
Value:
#define SPA_LOG_IMPL_INIT(name)
Definition log-impl.h:127
#define SPA_LOG_IMPL_DEFINE(name)
Definition log-impl.h:121
Examples
local-v4l2.c, spa/examples/adapter-control.c, spa/examples/example-control.c, spa/examples/local-libcamera.c, and spa/examples/local-v4l2.c.

◆ SPA_LOG_TOPIC_DEFAULT

#define SPA_LOG_TOPIC_DEFAULT   NULL

The default log topic.

Redefine this in your code to allow for the spa_log_* macros to work correctly, e.g:

struct spa_log_topic *mylogger;
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT mylogger
Identifier for a topic.
Definition log.h:103

◆ SPA_TYPE_INTERFACE_Log

◆ SPA_VERSION_LOG

#define SPA_VERSION_LOG   0

the version of this log.

This can be used to expand this structure in the future

◆ SPA_VERSION_LOG_TOPIC

#define SPA_VERSION_LOG_TOPIC   0

◆ SPA_VERSION_LOG_METHODS

#define SPA_VERSION_LOG_METHODS   1

◆ SPA_LOG_TOPIC

#define SPA_LOG_TOPIC ( v,
t )
Value:
(struct spa_log_topic){ .version = v, .topic = (t)}

◆ spa_log_topic_init

#define spa_log_topic_init ( l,
topic )

◆ spa_log_level_enabled

#define spa_log_level_enabled ( l,
lev )
Value:
((l) && (l)->level >= (lev))

◆ spa_log_level_topic_enabled

#define spa_log_level_topic_enabled ( l,
topic,
lev )

◆ spa_log_logt

#define spa_log_logt ( l,
lev,
topic,
... )

◆ spa_log_logtv

#define spa_log_logtv ( l,
lev,
topic,
... )

◆ spa_log_log

#define spa_log_log ( l,
lev,
... )
Value:
#define SPA_LOG_TOPIC_DEFAULT
The default log topic.
Definition log.h:63
#define spa_log_logt(l, lev, topic,...)
Definition log.h:252

◆ spa_log_logv

#define spa_log_logv ( l,
lev,
... )
Value:
#define spa_log_logtv(l, lev, topic,...)
Definition log.h:268

◆ spa_log_error

#define spa_log_error ( l,
... )
Value:
spa_log_log(l,SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
#define spa_log_log(l, lev,...)
Definition log.h:283
@ SPA_LOG_LEVEL_ERROR
Definition log.h:67

◆ spa_log_warn

#define spa_log_warn ( l,
... )
Value:
spa_log_log(l,SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
@ SPA_LOG_LEVEL_WARN
Definition log.h:68

◆ spa_log_info

#define spa_log_info ( l,
... )
Value:
spa_log_log(l,SPA_LOG_LEVEL_INFO,__FILE__,__LINE__,__func__,__VA_ARGS__)
@ SPA_LOG_LEVEL_INFO
Definition log.h:69

◆ spa_log_debug

#define spa_log_debug ( l,
... )
Value:
spa_log_log(l,SPA_LOG_LEVEL_DEBUG,__FILE__,__LINE__,__func__,__VA_ARGS__)
@ SPA_LOG_LEVEL_DEBUG
Definition log.h:70

◆ spa_log_trace

#define spa_log_trace ( l,
... )
Value:
spa_log_log(l,SPA_LOG_LEVEL_TRACE,__FILE__,__LINE__,__func__,__VA_ARGS__)
@ SPA_LOG_LEVEL_TRACE
Definition log.h:71

◆ spa_logt_error

#define spa_logt_error ( l,
t,
... )
Value:
spa_log_logt(l,SPA_LOG_LEVEL_ERROR,t,__FILE__,__LINE__,__func__,__VA_ARGS__)

◆ spa_logt_warn

#define spa_logt_warn ( l,
t,
... )
Value:
spa_log_logt(l,SPA_LOG_LEVEL_WARN,t,__FILE__,__LINE__,__func__,__VA_ARGS__)

◆ spa_logt_info

#define spa_logt_info ( l,
t,
... )
Value:
spa_log_logt(l,SPA_LOG_LEVEL_INFO,t,__FILE__,__LINE__,__func__,__VA_ARGS__)

◆ spa_logt_debug

#define spa_logt_debug ( l,
t,
... )
Value:
spa_log_logt(l,SPA_LOG_LEVEL_DEBUG,t,__FILE__,__LINE__,__func__,__VA_ARGS__)

◆ spa_logt_trace

#define spa_logt_trace ( l,
t,
... )
Value:
spa_log_logt(l,SPA_LOG_LEVEL_TRACE,t,__FILE__,__LINE__,__func__,__VA_ARGS__)

◆ spa_log_trace_fp

#define spa_log_trace_fp ( l,
... )
Value:
spa_log_log(l,SPA_LOG_LEVEL_TRACE,__FILE__,__LINE__,__func__,__VA_ARGS__)

◆ SPA_KEY_LOG_LEVEL

#define SPA_KEY_LOG_LEVEL   "log.level"

keys can be given when initializing the logger handle

the default log level

◆ SPA_KEY_LOG_COLORS

#define SPA_KEY_LOG_COLORS   "log.colors"

enable colors in the logger

◆ SPA_KEY_LOG_FILE

#define SPA_KEY_LOG_FILE   "log.file"

log to the specified file instead of stderr.

◆ SPA_KEY_LOG_TIMESTAMP

#define SPA_KEY_LOG_TIMESTAMP   "log.timestamp"

log timestamps

◆ SPA_KEY_LOG_LINE

#define SPA_KEY_LOG_LINE   "log.line"

log file and line numbers

◆ SPA_KEY_LOG_PATTERNS

#define SPA_KEY_LOG_PATTERNS   "log.patterns"

Spa:String:JSON array of [ {"pattern" : level}, ... ].

Enumeration Type Documentation

◆ spa_log_level

Enumerator
SPA_LOG_LEVEL_NONE 
SPA_LOG_LEVEL_ERROR 
SPA_LOG_LEVEL_WARN 
SPA_LOG_LEVEL_INFO 
SPA_LOG_LEVEL_DEBUG 
SPA_LOG_LEVEL_TRACE 

Function Documentation

◆ spa_log_impl_logtv()

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 )
inlinestatic

◆ spa_log_impl_logt()

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,
... )
inlinestatic

◆ spa_log_impl_logv()

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 )
inlinestatic

◆ spa_log_impl_log()

static void spa_log_impl_log ( void * object,
enum spa_log_level level,
const char * file,
int line,
const char * func,
const char * fmt,
... )
inlinestatic

◆ spa_log_impl_topic_init()

static void spa_log_impl_topic_init ( void * object,
struct spa_log_topic * topic )
inlinestatic