/** The default log topic. Redefine this in your code to * allow for the spa_log_* macros to work correctly, e.g: * * \code{.c} * struct spa_log_topic *mylogger; * #undef SPA_LOG_TOPIC_DEFAULT * #define SPA_LOG_TOPIC_DEFAULT mylogger * \endcode
*/ #define SPA_LOG_TOPIC_DEFAULT NULL
/** * The Log interface
*/ #define SPA_TYPE_INTERFACE_Log SPA_TYPE_INFO_INTERFACE_BASE "Log"
struct spa_log { /** the version of this log. This can be used to expand this
* structure in the future */ #define SPA_VERSION_LOG 0 struct spa_interface iface; /** * Logging level, everything above this level is not logged
*/ enum spa_log_level level;
};
/** * \struct spa_log_topic * * Identifier for a topic. Topics are string-based filters that logically * group messages together. An implementation may decide to filter different * topics on different levels, for example the "protocol" topic may require * debug level TRACE while the "core" topic defaults to debug level INFO. * * spa_log_topics require a spa_log_methods version of 1 or higher.
*/ struct spa_log_topic { #define SPA_VERSION_LOG_TOPIC 0 /** the version of this topic. This can be used to expand this
* structure in the future */
uint32_t version; /** The string identifier for the topic */ constchar *topic; /** Logging level set for this topic */ enum spa_log_level level; /** False if this topic follows the \ref spa_log level */ bool has_custom_level;
};
struct spa_log_methods { #define SPA_VERSION_LOG_METHODS 1
uint32_t version; /** * Log a message with the given log level. * * \note If compiled with this header, this function is only called * for implementations of version 0. For versions 1 and above, see * logt() instead. * * \param log a spa_log * \param level a spa_log_level * \param file the file name * \param line the line number * \param func the function name * \param fmt printf style format * \param ... format arguments
*/ void (*log) (void *object, enum spa_log_level level, constchar *file, int line, constchar *func, constchar *fmt, ...) SPA_PRINTF_FUNC(6, 7);
/** * Log a message with the given log level. * * \note If compiled with this header, this function is only called * for implementations of version 0. For versions 1 and above, see * logtv() instead. * * \param log a spa_log * \param level a spa_log_level * \param file the file name * \param line the line number * \param func the function name * \param fmt printf style format * \param args format arguments
*/ void (*logv) (void *object, enum spa_log_level level, constchar *file, int line, constchar *func, constchar *fmt,
va_list args) SPA_PRINTF_FUNC(6, 0); /** * Log a message with the given log level for the given topic. * * \note Callers that do not use topic-based logging (version 0), the \a * topic is NULL * * \param log a spa_log * \param level a spa_log_level * \param topic the topic for this message, may be NULL * \param file the file name * \param line the line number * \param func the function name * \param fmt printf style format * \param ... format arguments * * \since 1
*/ void (*logt) (void *object, enum spa_log_level level, conststruct spa_log_topic *topic, constchar *file, int line, constchar *func, constchar *fmt, ...) SPA_PRINTF_FUNC(7, 8);
/** * Log a message with the given log level for the given topic. * * \note For callers that do not use topic-based logging (version 0), * the \a topic is NULL * * \param log a spa_log * \param level a spa_log_level * \param topic the topic for this message, may be NULL * \param file the file name * \param line the line number * \param func the function name * \param fmt printf style format * \param args format arguments * * \since 1
*/ void (*logtv) (void *object, enum spa_log_level level, conststruct spa_log_topic *topic, constchar *file, int line, constchar *func, constchar *fmt,
va_list args) SPA_PRINTF_FUNC(7, 0);
/** * Initializes a \ref spa_log_topic to the correct logging level. * * \since 1
*/ void (*topic_init) (void *object, struct spa_log_topic *topic);
};
/** keys can be given when initializing the logger handle */ #define SPA_KEY_LOG_LEVEL "log.level"/**< the default log level */ #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}, ... ] */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.