diff options
author | David Robillard <d@drobilla.net> | 2021-01-13 20:00:25 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:06 -0500 |
commit | 468f7dc4294905d19f55c58c47ba91cd23bf357b (patch) | |
tree | 3531d4dbc53e3454534ea607dfa4f44d0f085f5d /src/world.h | |
parent | 229443778ffc6b26a13322983b81f4f1912427af (diff) | |
download | serd-468f7dc4294905d19f55c58c47ba91cd23bf357b.tar.gz serd-468f7dc4294905d19f55c58c47ba91cd23bf357b.tar.bz2 serd-468f7dc4294905d19f55c58c47ba91cd23bf357b.zip |
WIP: Add extensible logging API
Diffstat (limited to 'src/world.h')
-rw-r--r-- | src/world.h | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/world.h b/src/world.h index f76b9483..7a4a129d 100644 --- a/src/world.h +++ b/src/world.h @@ -19,13 +19,14 @@ #include "serd/serd.h" +#include <stdarg.h> #include <stdint.h> #include <stdio.h> struct SerdWorldImpl { SerdNodes* nodes; - SerdErrorFunc error_func; - void* error_handle; + SerdLogFunc log_func; + void* log_handle; SerdNode* blank_node; const SerdNode* rdf_first; const SerdNode* rdf_nil; @@ -38,10 +39,33 @@ struct SerdWorldImpl { uint32_t next_blank_id; }; +/// Write a message to the log +SERD_API +SERD_LOG_FUNC(5, 0) SerdStatus -serd_world_error(const SerdWorld* world, const SerdError* e); +serd_world_vlogf_internal(const SerdWorld* world, + SerdStatus st, + SerdLogLevel level, + const SerdCursor* cursor, + const char* fmt, + va_list args); +/// Write a message to the log +SERD_API +SERD_LOG_FUNC(5, 6) SerdStatus -serd_world_errorf(const SerdWorld* world, SerdStatus st, const char* fmt, ...); +serd_world_logf_internal(const SerdWorld* world, + SerdStatus st, + SerdLogLevel level, + const SerdCursor* cursor, + const char* fmt, + ...); + +#define SERD_LOG_ERRORF(world, st, fmt, ...) \ + serd_world_logf_internal( \ + world, st, SERD_LOG_LEVEL_ERR, NULL, fmt, __VA_ARGS__) + +#define SERD_LOG_ERROR(world, st, msg) \ + serd_world_logf_internal(world, st, SERD_LOG_LEVEL_ERR, NULL, msg) #endif // SERD_WORLD_H |