aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-13 20:00:25 +0100
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:06 -0500
commit468f7dc4294905d19f55c58c47ba91cd23bf357b (patch)
tree3531d4dbc53e3454534ea607dfa4f44d0f085f5d /src/writer.c
parent229443778ffc6b26a13322983b81f4f1912427af (diff)
downloadserd-468f7dc4294905d19f55c58c47ba91cd23bf357b.tar.gz
serd-468f7dc4294905d19f55c58c47ba91cd23bf357b.tar.bz2
serd-468f7dc4294905d19f55c58c47ba91cd23bf357b.zip
WIP: Add extensible logging API
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/writer.c b/src/writer.c
index f55b47d4..d15320ae 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -135,8 +135,8 @@ struct SerdWriterImpl {
WriteContext* anon_stack;
size_t anon_stack_size;
SerdByteSink* byte_sink;
- SerdErrorFunc error_func;
- void* error_handle;
+ SerdLogFunc log_func;
+ void* log_handle;
WriteContext context;
char* bprefix;
size_t bprefix_len;
@@ -237,12 +237,12 @@ sink(const void* buf, size_t len, SerdWriter* writer)
const size_t written = serd_byte_sink_write(buf, len, writer->byte_sink);
if (written != len) {
if (errno) {
- serd_world_errorf(writer->world,
- SERD_ERR_BAD_WRITE,
- "write error (%s)\n",
- strerror(errno));
+ SERD_LOG_ERRORF(writer->world,
+ SERD_ERR_BAD_WRITE,
+ "write error (%s)\n",
+ strerror(errno));
} else {
- serd_world_errorf(writer->world, SERD_ERR_BAD_WRITE, "write error\n");
+ SERD_LOG_ERROR(writer->world, SERD_ERR_BAD_WRITE, "write error\n");
}
}
@@ -267,7 +267,7 @@ write_character(SerdWriter* writer,
const uint32_t c = parse_utf8_char(utf8, size);
switch (*size) {
case 0:
- serd_world_errorf(
+ SERD_LOG_ERRORF(
writer->world, SERD_ERR_BAD_ARG, "invalid UTF-8 start: %X\n", utf8[0]);
*st = SERD_ERR_BAD_TEXT;
return 0;
@@ -767,10 +767,10 @@ write_uri_node(SerdWriter* const writer,
if (!has_scheme && !supports_uriref(writer) &&
!serd_env_base_uri(writer->env)) {
- serd_world_errorf(writer->world,
- SERD_ERR_BAD_ARG,
- "syntax does not support URI reference <%s>\n",
- node_str);
+ SERD_LOG_ERRORF(writer->world,
+ SERD_ERR_BAD_ARG,
+ "syntax does not support URI reference <%s>\n",
+ node_str);
return SERD_ERR_BAD_ARG;
}
@@ -817,10 +817,10 @@ write_curie(SerdWriter* const writer,
case SERD_NTRIPLES:
case SERD_NQUADS:
if ((st = serd_env_expand_in_place(writer->env, node, &prefix, &suffix))) {
- serd_world_errorf(writer->world,
- st,
- "undefined namespace prefix `%s'\n",
- serd_node_string(node));
+ SERD_LOG_ERRORF(writer->world,
+ st,
+ "undefined namespace prefix in `%s'\n",
+ serd_node_string(node));
return st;
}
TRY(st, esink("<", 1, writer));
@@ -1113,10 +1113,10 @@ serd_writer_end_anon(SerdWriter* writer, const SerdNode* node)
}
if (writer->anon_stack_size == 0) {
- return serd_world_errorf(writer->world,
- SERD_ERR_UNKNOWN,
- "unexpected end of anonymous node `%s'\n",
- serd_node_string(node));
+ return SERD_LOG_ERRORF(writer->world,
+ SERD_ERR_UNKNOWN,
+ "unexpected end of anonymous node `%s'\n",
+ serd_node_string(node));
}
SerdStatus st = write_sep(writer, writer->context.flags, SEP_ANON_END);