From 18a4fbdf46e681e66238ebd3f895c3dc850e691e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Jan 2019 11:50:34 +0100 Subject: Expose and annotate logging functions --- src/world.c | 16 ++++++++++++++++ src/world.h | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/world.c b/src/world.c index 483c46a6..7b0343cc 100644 --- a/src/world.c +++ b/src/world.c @@ -69,6 +69,22 @@ serd_world_log(const SerdWorld* world, const SerdMessage* msg) return msg->status; } +SerdStatus +serd_world_logf(const SerdWorld* world, + SerdStatus st, + SerdLogLevel level, + const SerdCursor* cursor, + const char* fmt, + ...) +{ + va_list args; + va_start(args, fmt); + const SerdMessage msg = {st, level, cursor, fmt, &args}; + serd_world_log(world, &msg); + va_end(args); + return st; +} + SerdStatus serd_world_errorf(const SerdWorld* world, SerdStatus st, const char* fmt, ...) { diff --git a/src/world.h b/src/world.h index f4e7ee3e..9d6dd4d2 100644 --- a/src/world.h +++ b/src/world.h @@ -39,8 +39,7 @@ struct SerdWorldImpl { FILE* serd_world_fopen(SerdWorld* world, const char* path, const char* mode); -SerdStatus serd_world_log(const SerdWorld* world, const SerdMessage* msg); - +SERD_LOG_FUNC(3, 4) SerdStatus serd_world_errorf(const SerdWorld* world, SerdStatus st, const char* fmt, ...); -- cgit v1.2.1