diff --git a/libweston/weston-log-internal.h b/libweston/weston-log-internal.h index 222a751b..6e28a4f5 100644 --- a/libweston/weston-log-internal.h +++ b/libweston/weston-log-internal.h @@ -102,4 +102,10 @@ weston_vlog(const char *fmt, va_list ap); int weston_vlog_continue(const char *fmt, va_list ap); +void * +weston_log_subscription_get_data(struct weston_log_subscription *sub); + +void +weston_log_subscription_set_data(struct weston_log_subscription *sub, void *data); + #endif /* WESTON_LOG_INTERNAL_H */ diff --git a/libweston/weston-log.c b/libweston/weston-log.c index 1021ebb2..de5220e1 100644 --- a/libweston/weston-log.c +++ b/libweston/weston-log.c @@ -113,6 +113,8 @@ struct weston_log_subscription { struct weston_log_scope *source; struct wl_list source_link; /**< weston_log_scope::subscription_list or weston_log_context::pending_subscription_list */ + + void *data; }; static struct weston_log_subscription * @@ -208,6 +210,20 @@ weston_log_subscription_vprintf(struct weston_log_subscription *sub, } } +void +weston_log_subscription_set_data(struct weston_log_subscription *sub, void *data) +{ + /* don't allow data to already be set */ + assert(!sub->data); + sub->data = data; +} + +void * +weston_log_subscription_get_data(struct weston_log_subscription *sub) +{ + return sub->data; +} + /** Creates a new subscription using the subscriber by \c owner. * * The subscription created is added to the \c owner subscription list.