diff options
Diffstat (limited to 'src/world.c')
-rw-r--r-- | src/world.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/world.c b/src/world.c index f16b0f95..be4be551 100644 --- a/src/world.c +++ b/src/world.c @@ -51,24 +51,30 @@ serd_world_fopen(SerdWorld* world, const char* path, const char* mode) } SerdStatus -serd_world_log(const SerdWorld* world, const SerdMessage* msg) +serd_world_vlogf(const SerdWorld* world, + SerdStatus st, + SerdLogLevel level, + const SerdCursor* cursor, + const char* fmt, + va_list args) { - static const char* level_strings[] = { "note", "warning", "error" }; + static const char* const level_strings[] = { "note", "warning", "error" }; if (world->msg_func) { - world->msg_func(world->msg_handle, msg); + world->msg_func(world->msg_handle, st, level, cursor, fmt, args); } else { - fprintf(stderr, "%s: ", level_strings[msg->level]); - if (msg->cursor) { + fprintf(stderr, "%s: ", level_strings[level]); + if (cursor) { fprintf(stderr, "%s:%u:%u: ", - serd_node_get_string(msg->cursor->file), - msg->cursor->line, - msg->cursor->col); + serd_node_get_string(cursor->file), + cursor->line, + cursor->col); } - vfprintf(stderr, msg->fmt, *msg->args); + vfprintf(stderr, fmt, args); } - return msg->status; + + return st; } SerdStatus @@ -81,8 +87,7 @@ serd_world_logf(const SerdWorld* world, { va_list args; va_start(args, fmt); - const SerdMessage msg = {st, level, cursor, fmt, &args}; - serd_world_log(world, &msg); + serd_world_vlogf(world, st, level, cursor, fmt, args); va_end(args); return st; } |