diff options
author | David Robillard <d@drobilla.net> | 2019-01-12 11:50:34 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-04-13 19:15:32 +0200 |
commit | 18a4fbdf46e681e66238ebd3f895c3dc850e691e (patch) | |
tree | 6c9d4b76cf1794ca8b2862d05094ace4d872cfde /serd | |
parent | 1ba62144ef3bc75610971af121a3b5a6dc868f42 (diff) | |
download | serd-18a4fbdf46e681e66238ebd3f895c3dc850e691e.tar.gz serd-18a4fbdf46e681e66238ebd3f895c3dc850e691e.tar.bz2 serd-18a4fbdf46e681e66238ebd3f895c3dc850e691e.zip |
Expose and annotate logging functions
Diffstat (limited to 'serd')
-rw-r--r-- | serd/serd.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/serd/serd.h b/serd/serd.h index 9b3e35f6..ec5d9228 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -42,6 +42,12 @@ # define SERD_API #endif +#if defined(__GNUC__) +# define SERD_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1))) +#else +# define SERD_LOG_FUNC(fmt, arg1) +#endif + #ifdef __cplusplus extern "C" { #endif @@ -823,6 +829,22 @@ serd_world_set_message_sink(SerdWorld* world, SerdMessageSink msg_sink, void* handle); +/// Write a message to the log +SERD_API +SerdStatus +serd_world_log(const SerdWorld* world, const SerdMessage* msg); + +/// Write a message to the log +SERD_API +SERD_LOG_FUNC(5, 6) +SerdStatus +serd_world_logf(const SerdWorld* world, + SerdStatus st, + SerdLogLevel level, + const SerdCursor* cursor, + const char* fmt, + ...); + /** @} @name Environment |