diff options
Diffstat (limited to 'src/log.c')
-rw-r--r-- | src/log.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -18,6 +18,7 @@ #include "serd/serd.h" +#include <assert.h> #include <stdarg.h> #include <stdbool.h> #include <stdio.h> @@ -106,6 +107,8 @@ serd_set_log_func(SerdWorld* const world, const SerdLogFunc log_func, void* const handle) { + assert(world); + world->log_func = log_func; world->log_handle = handle; } @@ -118,6 +121,9 @@ serd_vxlogf(const SerdWorld* const world, const char* const fmt, va_list args) { + assert(world); + assert(fmt); + if (world->log_func) { char message[512] = {0}; const int r = vsnprintf(message, sizeof(message), fmt, args); @@ -165,6 +171,9 @@ serd_xlogf(const SerdWorld* const world, const char* const fmt, ...) { + assert(world); + assert(fmt); + va_list args; va_start(args, fmt); @@ -180,6 +189,9 @@ serd_vlogf(const SerdWorld* const world, const char* const fmt, va_list args) { + assert(world); + assert(fmt); + return serd_vxlogf(world, level, 0u, NULL, fmt, args); } @@ -189,6 +201,9 @@ serd_logf(const SerdWorld* const world, const char* const fmt, ...) { + assert(world); + assert(fmt); + va_list args; va_start(args, fmt); @@ -205,6 +220,9 @@ serd_vlogf_at(const SerdWorld* SERD_NONNULL world, const char* SERD_NONNULL fmt, va_list args) { + assert(world); + assert(fmt); + if (!caret) { return serd_vxlogf(world, level, 0u, NULL, fmt, args); } @@ -230,6 +248,9 @@ serd_logf_at(const SerdWorld* SERD_NONNULL world, const char* SERD_NONNULL fmt, ...) { + assert(world); + assert(fmt); + va_list args; va_start(args, fmt); |