PipeWire  0.3.30
SPA Logging

Data Structures

struct  spa_log
 
struct  spa_log_methods
 

Macros

#define SPA_LOG_IMPL_DEFINE(name)
 
#define SPA_LOG_IMPL_INIT(name)
 
#define SPA_LOG_IMPL(name)    SPA_LOG_IMPL_DEFINE(name) = SPA_LOG_IMPL_INIT(name)
 
#define SPA_TYPE_INTERFACE_Log   SPA_TYPE_INFO_INTERFACE_BASE "Log"
 The Log interface. More...
 
#define SPA_VERSION_LOG   0
 
#define spa_log_level_enabled(l, lev)   ((l) && (l)->level >= (lev))
 
#define SPA_LOG_FUNC(name, lev)
 
#define SPA_KEY_LOG_LEVEL   "log.level"
 keys can be given when initializing the logger handle More...
 
#define SPA_KEY_LOG_COLORS   "log.colors"
 enable colors in the logger More...
 
#define SPA_KEY_LOG_FILE   "log.file"
 log to the specified file instead of stderr. More...
 
#define SPA_KEY_LOG_TIMESTAMP   "log.timestamp"
 log timestamps More...
 
#define SPA_KEY_LOG_LINE   "log.line"
 log file and line numbers More...
 

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

 SPA_PRINTF_FUNC (6, 0) void spa_log_impl_logv(void *object
 
 if (basename) basename+
 
 vsnprintf (text, sizeof(text), fmt, args)
 
 snprintf (location, sizeof(location), "[%s][%s:%i %s()] %s\n", levels[level], basename, line, func, text)
 
 fputs (location, stderr)
 
 SPA_PRINTF_FUNC (6, 7) void spa_log_impl_log(void *object
 
enum spa_log_level level const char int const char const char va_start (args, fmt)
 
 spa_log_impl_logv (object, level, file, line, func, fmt, args)
 
 va_end (args)
 

Variables

enum spa_log_level level const char * file
 
enum spa_log_level level const char int line
 
enum spa_log_level level const char int const char * func
 
enum spa_log_level level const char int const char const char * fmt
 
enum spa_log_level level const char int const char const char va_list args
 
const char * basename = strrchr(file, '/')
 
char text [512]
 
char location [1024]
 

Detailed Description

Macro Definition Documentation

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

#define SPA_KEY_LOG_LEVEL   "log.level"

keys can be given when initializing the logger handle

the default log level

◆ SPA_KEY_LOG_LINE

#define SPA_KEY_LOG_LINE   "log.line"

log file and line numbers

◆ SPA_KEY_LOG_TIMESTAMP

#define SPA_KEY_LOG_TIMESTAMP   "log.timestamp"

log timestamps

◆ SPA_LOG_FUNC

#define SPA_LOG_FUNC (   name,
  lev 
)
Value:
/* static */ inline SPA_PRINTF_FUNC(2,3) void spa_log_##name (struct spa_log *l, const char *format, ...) \
{ \
if (SPA_UNLIKELY(spa_log_level_enabled(l, lev))) { \
va_list varargs; \
va_start (varargs, format); \
spa_interface_call(&l->iface, \
struct spa_log_methods, logv, 0, lev, \
__FILE__,__LINE__,__func__,format,varargs); \
va_end (varargs); \
} \
}

◆ SPA_LOG_IMPL

#define SPA_LOG_IMPL (   name)     SPA_LOG_IMPL_DEFINE(name) = SPA_LOG_IMPL_INIT(name)

◆ SPA_LOG_IMPL_DEFINE

#define SPA_LOG_IMPL_DEFINE (   name)
Value:
struct { \
struct spa_log log; \
struct spa_log_methods methods; \
} name

◆ SPA_LOG_IMPL_INIT

#define SPA_LOG_IMPL_INIT (   name)
Value:
SPA_CALLBACKS_INIT(&name.methods, &name) }, \
SPA_LOG_LEVEL_INFO, }, \
spa_log_impl_log, \
spa_log_impl_logv,} }

◆ spa_log_level_enabled

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

◆ SPA_TYPE_INTERFACE_Log

#define SPA_TYPE_INTERFACE_Log   SPA_TYPE_INFO_INTERFACE_BASE "Log"

The Log interface.

◆ SPA_VERSION_LOG

#define SPA_VERSION_LOG   0

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

◆ fputs()

fputs ( location  ,
stderr   
)

◆ if()

if ( basename  )

◆ snprintf()

snprintf ( location  ,
sizeof(location ,
" %s\n"  [%s][%s:%i %s()],
levels  [level],
basename  ,
line  ,
func  ,
text   
)

◆ spa_log_impl_logv()

spa_log_impl_logv ( object  ,
level  ,
file  ,
line  ,
func  ,
fmt  ,
args   
)

◆ SPA_PRINTF_FUNC() [1/2]

SPA_PRINTF_FUNC ( ,
 
)
inline

◆ SPA_PRINTF_FUNC() [2/2]

SPA_PRINTF_FUNC ( ,
 
)
inline

References args.

◆ va_end()

va_end ( args  )

◆ va_start()

enum spa_log_level level const char int const char const char va_start ( args  ,
fmt   
)

◆ vsnprintf()

vsnprintf ( text  ,
sizeof(text ,
fmt  ,
args   
)

Variable Documentation

◆ args

enum spa_log_level level const char int const char const char va_list args
Initial value:
{
static const char * const levels[] = { "-", "E", "W", "I", "D", "T" }

Referenced by SPA_PRINTF_FUNC().

◆ basename

else basename = strrchr(file, '/')

◆ file

enum spa_log_level level const char * file

Referenced by pw_log_log_object().

◆ fmt

enum spa_log_level level const char int const char const char * fmt

◆ func

enum spa_log_level level const char int const char * func

◆ line

enum spa_log_level level const char int line

Referenced by pw_log_log_object().

◆ location

char location[1024]

◆ text

char text[512]

Referenced by spa_i18n_text().

SPA_PRINTF_FUNC
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:205
spa_log
Definition: build-11172026/doc/spa/support/log.h:62
SPA_VERSION_LOG
#define SPA_VERSION_LOG
Definition: build-11172026/doc/spa/support/log.h:60
SPA_TYPE_INTERFACE_Log
#define SPA_TYPE_INTERFACE_Log
The Log interface.
Definition: build-11172026/doc/spa/support/log.h:58
SPA_VERSION_LOG_METHODS
#define SPA_VERSION_LOG_METHODS
Definition: build-11172026/doc/spa/support/log.h:73
spa_log_methods
Definition: build-11172026/doc/spa/support/log.h:72