PipeWire 1.2.6

Loading...
Searching...
No Matches
Files | Data Structures | Enumerations | Macros | Functions
Log
SPA » Support

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_topic_enum
| Enumeration of log topics in a plugin. More...
struct | spa_log_methods

## 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 }

## 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_TOPIC_ENUM 0
#define | SPA_VERSION_LOG_METHODS 1
#define | SPA_LOG_TOPIC(v, t)
#define | spa_log_logt(l, lev, topic, ...)
#define | spa_log_logtv(l, lev, topic, ...)
#define | spa_logt_lev(l, lev, t, ...)
#define | spa_log_lev(l, lev, ...)
#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_LOG_TOPIC_ENUM_NAME "spa_log_topic_enum"
| Name of the symbol indicating a spa_log_topic_enum enumerating the static log topics in a plugin,.
#define | SPA_LOG_TOPIC_ENUM_DEFINE(s, e)
| Define the symbol for SPA_LOG_TOPIC_ENUM_NAME.
#define | SPA_LOG_TOPIC_REGISTER(v)
| Magically register a statically defined spa_log_topic into the log topic enumeration for a plugin.
#define | SPA_LOG_TOPIC_DEFINE(var, name)
| Define and magically register a spa_log_topic.
#define | SPA_LOG_TOPIC_DEFINE_STATIC(var, name)
| Define and magically register a spa_log_topic with static scope.
#define | SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED
| Do SPA_LOG_TOPIC_ENUM_DEFINE for the auto-registered spa_log_topic in the plugin.
#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, set to "force" to enable colors even when not logging to a terminal
#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}, ... ].

## 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 1)
static void | spa_log_topic_init (struct spa_log *log, struct spa_log_topic *topic)
static bool | spa_log_level_topic_enabled (const struct spa_log *log, const struct spa_log_topic *topic, enum spa_log_level level)

## Detailed Description

Logging interface

## Enumeration Type Documentation

## ◆ spa_log_level

enum 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 |

## 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:
SPA_LOG_IMPL_DEFINE(name) = SPA_LOG_IMPL_INIT(name)
SPA_LOG_IMPL_INIT
#define SPA_LOG_IMPL_INIT(name)
Definition log-impl.h:107
SPA_LOG_IMPL_DEFINE
#define SPA_LOG_IMPL_DEFINE(name)
Definition log-impl.h:101

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
spa_log_topic
Identifier for a topic.
Definition log.h:83

## ◆ SPA_TYPE_INTERFACE_Log

#define SPA_TYPE_INTERFACE_Log SPA_TYPE_INFO_INTERFACE_BASE "Log"

The Log interface.

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_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_TOPIC_ENUM

#define SPA_VERSION_LOG_TOPIC_ENUM 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_logt

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

## ◆ spa_log_logtv

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

## ◆ spa_logt_lev

#define spa_logt_lev | ( |  | l,
|  |  | lev,
|  |  | t,
|  |  | ... )

Value:
spa_log_logt(l,lev,t,__FILE__,__LINE__,__func__,__VA_ARGS__)
spa_log_logt
#define spa_log_logt(l, lev, topic,...)
Definition log.h:254

## ◆ spa_log_lev

#define spa_log_lev | ( |  | l,
|  |  | lev,
|  |  | ... )

Value:
spa_logt_lev(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
spa_logt_lev
#define spa_logt_lev(l, lev, t,...)
Definition log.h:285
SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT
The default log topic.
Definition log.h:43

## ◆ spa_log_log

#define spa_log_log | ( |  | l,
|  |  | lev,
|  |  | ... )

Value:
spa_log_logt(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)

## ◆ spa_log_logv

#define spa_log_logv | ( |  | l,
|  |  | lev,
|  |  | ... )

Value:
spa_log_logtv(l,lev,SPA_LOG_TOPIC_DEFAULT,__VA_ARGS__)
spa_log_logtv
#define spa_log_logtv(l, lev, topic,...)
Definition log.h:270

## ◆ spa_log_error

#define spa_log_error | ( |  | l,
|  |  | ... )

Value:
spa_log_lev(l,SPA_LOG_LEVEL_ERROR,__VA_ARGS__)
spa_log_lev
#define spa_log_lev(l, lev,...)
Definition log.h:288
SPA_LOG_LEVEL_ERROR
@ SPA_LOG_LEVEL_ERROR
Definition log.h:47

## ◆ spa_log_warn

#define spa_log_warn | ( |  | l,
|  |  | ... )

Value:
spa_log_lev(l,SPA_LOG_LEVEL_WARN,__VA_ARGS__)
SPA_LOG_LEVEL_WARN
@ SPA_LOG_LEVEL_WARN
Definition log.h:48

## ◆ spa_log_info

#define spa_log_info | ( |  | l,
|  |  | ... )

Value:
spa_log_lev(l,SPA_LOG_LEVEL_INFO,__VA_ARGS__)
SPA_LOG_LEVEL_INFO
@ SPA_LOG_LEVEL_INFO
Definition log.h:49

## ◆ spa_log_debug

#define spa_log_debug | ( |  | l,
|  |  | ... )

Value:
spa_log_lev(l,SPA_LOG_LEVEL_DEBUG,__VA_ARGS__)
SPA_LOG_LEVEL_DEBUG
@ SPA_LOG_LEVEL_DEBUG
Definition log.h:50

## ◆ spa_log_trace

#define spa_log_trace | ( |  | l,
|  |  | ... )

Value:
spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__)
SPA_LOG_LEVEL_TRACE
@ SPA_LOG_LEVEL_TRACE
Definition log.h:51

## ◆ spa_logt_error

#define spa_logt_error | ( |  | l,
|  |  | t,
|  |  | ... )

Value:
spa_logt_lev(l,SPA_LOG_LEVEL_ERROR,t,__VA_ARGS__)

## ◆ spa_logt_warn

#define spa_logt_warn | ( |  | l,
|  |  | t,
|  |  | ... )

Value:
spa_logt_lev(l,SPA_LOG_LEVEL_WARN,t,__VA_ARGS__)

## ◆ spa_logt_info

#define spa_logt_info | ( |  | l,
|  |  | t,
|  |  | ... )

Value:
spa_logt_lev(l,SPA_LOG_LEVEL_INFO,t,__VA_ARGS__)

## ◆ spa_logt_debug

#define spa_logt_debug | ( |  | l,
|  |  | t,
|  |  | ... )

Value:
spa_logt_lev(l,SPA_LOG_LEVEL_DEBUG,t,__VA_ARGS__)

## ◆ spa_logt_trace

#define spa_logt_trace | ( |  | l,
|  |  | t,
|  |  | ... )

Value:
spa_logt_lev(l,SPA_LOG_LEVEL_TRACE,t,__VA_ARGS__)

## ◆ spa_log_trace_fp

#define spa_log_trace_fp | ( |  | l,
|  |  | ... )

Value:
spa_log_lev(l,SPA_LOG_LEVEL_TRACE,__VA_ARGS__)

## ◆ SPA_LOG_TOPIC_ENUM_NAME

#define SPA_LOG_TOPIC_ENUM_NAME "spa_log_topic_enum"

Name of the symbol indicating a spa_log_topic_enum enumerating the static log topics in a plugin,.

Since
  1.1.0

## ◆ SPA_LOG_TOPIC_ENUM_DEFINE

#define SPA_LOG_TOPIC_ENUM_DEFINE | ( |  | s,
|  |  | e )

Define the symbol for SPA_LOG_TOPIC_ENUM_NAME.

Since
  1.1.0

## ◆ SPA_LOG_TOPIC_REGISTER

#define SPA_LOG_TOPIC_REGISTER | ( |  | v | ) |

Magically register a statically defined spa_log_topic into the log topic enumeration for a plugin.

Since
  1.1.0

## ◆ SPA_LOG_TOPIC_DEFINE

#define SPA_LOG_TOPIC_DEFINE | ( |  | var,
|  |  | name )

Define and magically register a spa_log_topic.

Since
  1.1.0

## ◆ SPA_LOG_TOPIC_DEFINE_STATIC

#define SPA_LOG_TOPIC_DEFINE_STATIC | ( |  | var,
|  |  | name )

Define and magically register a spa_log_topic with static scope.

Since
  1.1.0

## ◆ SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED

#define SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED

Do SPA_LOG_TOPIC_ENUM_DEFINE for the auto-registered spa_log_topic in the plugin.

Since
  1.1.0

## ◆ 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, set to "force" to enable colors even when not logging to a terminal

## ◆ 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

Examples
  spa/examples/adapter-control.c.

## ◆ 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}, ... ].

## 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 )
| inline static

## ◆ 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,
|  |  | ... )
| inline static

## ◆ 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 )
| inline static

## ◆ 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,
|  |  | ... )
| inline static

## ◆ spa_log_impl_topic_init()

static void spa_log_impl_topic_init | ( | void * | object,
|  | struct spa_log_topic *topic | 1 )
| inline static

## ◆ spa_log_topic_init()

static void spa_log_topic_init | ( | struct spa_log * | log,
|  | struct spa_log_topic * | topic )
| inline static

## ◆ spa_log_level_topic_enabled()

static bool spa_log_level_topic_enabled | ( | const struct spa_log * | log,
|  | const struct spa_log_topic * | topic,
|  | enum spa_log_level | level )
| inline static