From 35ff4a8de5e1d9b37ac8d9c47a7c0ca3061d62bf Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Fri, 28 Jun 2019 14:08:24 +0300 Subject: [PATCH] libweston/log: Add 'wlog' group for weston_log() related functions This allows a better integration with the documentation of logging framework. Signed-off-by: Marius Vlad --- include/libweston/libweston.h | 3 +++ libweston/log.c | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index b13bea63..ab56aff8 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -1812,6 +1812,9 @@ weston_compositor_set_xkb_rule_names(struct weston_compositor *ec, /* String literal of spaces, the same width as the timestamp. */ #define STAMP_SPACE " " +/** + * \ingroup wlog + */ typedef int (*log_func_t)(const char *fmt, va_list ap); void weston_log_set_handler(log_func_t log, log_func_t cont); diff --git a/libweston/log.c b/libweston/log.c index ed63de54..6ce9454b 100644 --- a/libweston/log.c +++ b/libweston/log.c @@ -36,10 +36,23 @@ #include +/** + * \defgroup wlog weston-logging + */ + static int default_log_handler(const char *fmt, va_list ap); +/** Needs to be set, defaults to default_log_handler + * + * \ingroup wlog + */ static log_func_t log_handler = default_log_handler; + +/** Needs to be set, defaults to default_log_handler + * + * \ingroup wlog + */ static log_func_t log_continue_handler = default_log_handler; /** Sentinel log message handler @@ -51,6 +64,8 @@ static log_func_t log_continue_handler = default_log_handler; * * \param fmt The format string. Ignored. * \param ap The variadic argument list. Ignored. + * + * \ingroup wlog */ static int default_log_handler(const char *fmt, va_list ap) @@ -71,6 +86,8 @@ default_log_handler(const char *fmt, va_list ap) * when \a weston_log_continue is called, and should append * its output to the current line, without any header or * other content in between. + * + * \ingroup wlog */ WL_EXPORT void weston_log_set_handler(log_func_t log, log_func_t cont) @@ -79,12 +96,25 @@ weston_log_set_handler(log_func_t log, log_func_t cont) log_continue_handler = cont; } +/** weston_vlog calls log_handler + * \ingroup wlog + */ WL_EXPORT int weston_vlog(const char *fmt, va_list ap) { return log_handler(fmt, ap); } +/** printf() equivalent in weston compositor. + * + * \rststar + * .. note:: + * + * Needs :var:`log_handler` to be set-up! + * \endrststar + * + * \ingroup wlog + */ WL_EXPORT int weston_log(const char *fmt, ...) { @@ -98,12 +128,20 @@ weston_log(const char *fmt, ...) return l; } +/** weston_vlog_continue calls log_continue_handler + * + * \ingroup wlog + */ WL_EXPORT int weston_vlog_continue(const char *fmt, va_list argp) { return log_continue_handler(fmt, argp); } +/** weston_log_continue + * + * \ingroup wlog + */ WL_EXPORT int weston_log_continue(const char *fmt, ...) {