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 <marius.vlad@collabora.com>
This commit is contained in:
parent
8b8b803a46
commit
35ff4a8de5
|
@ -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);
|
||||
|
|
|
@ -36,10 +36,23 @@
|
|||
|
||||
#include <libweston/libweston.h>
|
||||
|
||||
/**
|
||||
* \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, ...)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue