aboutsummaryrefslogtreecommitdiffstats
path: root/serd
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-11-26 22:14:39 +0100
committerDavid Robillard <d@drobilla.net>2019-04-13 19:15:32 +0200
commitab7be940e5b9c74a842ec286abefa431ab8a840a (patch)
tree694d866afe94f64528c5ffb1727c4eb2a4f113d9 /serd
parent21db1e0ea65ff57edb23c204ea94fac9b1e5c3d3 (diff)
downloadserd-ab7be940e5b9c74a842ec286abefa431ab8a840a.tar.gz
serd-ab7be940e5b9c74a842ec286abefa431ab8a840a.tar.bz2
serd-ab7be940e5b9c74a842ec286abefa431ab8a840a.zip
Rename SerdError to SerdMessage
Towards more general usage for all types of logging.
Diffstat (limited to 'serd')
-rw-r--r--serd/serd.h38
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);
/**
@}