diff options
Diffstat (limited to 'serd')
-rw-r--r-- | serd/serd.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/serd/serd.h b/serd/serd.h index 90ad210f..e9484ec9 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -279,14 +279,24 @@ typedef struct { } SerdBuffer; /** - An error description. + Log message level. +*/ +typedef enum { + SERD_LOG_LEVEL_INFO = 0, /**< Normal informative message */ + SERD_LOG_LEVEL_WARNING = 1, /**< Warning */ + SERD_LOG_LEVEL_ERROR = 2, /**< Error */ +} SerdLogLevel; + +/** + A message description. */ typedef struct { - SerdStatus status; /**< Error code */ - const SerdCursor* cursor; /**< Origin of error, or NULL */ + SerdStatus status; /**< Status code */ + SerdLogLevel level; /**< Log level */ + const SerdCursor* cursor; /**< Origin of message, or NULL */ const char* fmt; /**< Message format string (printf style) */ va_list* args; /**< Arguments for fmt */ -} SerdError; +} SerdMessage; /** A parsed URI. @@ -802,13 +812,13 @@ serd_node_free(SerdNode* node); */ /** - Sink (callback) for errors. + Sink (callback) for log messages. @param handle Handle for user data. - @param error Error description. + @param msg Message description. */ -typedef SerdStatus (*SerdErrorSink)(void* handle, - const SerdError* error); +typedef SerdStatus (*SerdMessageSink)(void* handle, + const SerdMessage* msg); /** Sink (callback) for base URI changes. @@ -880,16 +890,16 @@ const SerdNode* serd_world_get_blank(SerdWorld* world); /** - Set a function to be called when errors occur. + Set a function to be called with log messages (typically errors). - The `error_sink` will be called with `handle` as its first argument. If - no error function is set, errors are printed to stderr. + The `msg_sink` will be called with `handle` as its first argument. If + no sink is set, messages are printed to stderr. */ SERD_API void -serd_world_set_error_sink(SerdWorld* world, - SerdErrorSink error_sink, - void* handle); +serd_world_set_message_sink(SerdWorld* world, + SerdMessageSink msg_sink, + void* handle); /** @} |