summaryrefslogtreecommitdiff
path: root/test/basic.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/basic.c')
-rw-r--r--test/basic.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/test/basic.c b/test/basic.c
index fd40633..7626dd8 100644
--- a/test/basic.c
+++ b/test/basic.c
@@ -13,21 +13,29 @@
NSLOG_DEFINE_CATEGORY(test, "Test category");
-static void test_render_function(void *ctx, nslog_entry_t *log)
+static void test_render_function(
+ void *_ctx, nslog_entry_context_t *ctx,
+ const char *fmt, va_list args)
{
(void)ctx;
- fprintf(stderr, "%s %s:%d [%s] %s() %s\n",
- nslog_level_name(log->level),
- log->filename, log->lineno,
- log->category->name,
- log->funcname,
- log->message);
+ fprintf(stderr, "%s %s:%d [%s] %s() ",
+ nslog_level_name(ctx->level),
+ ctx->filename, ctx->lineno,
+ ctx->category->name,
+ ctx->funcname);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
}
int main(int argc, char **argv)
{
nslog_set_render_callback(test_render_function, NULL);
+ NSLOG(test, INFO, "Pre-uncorking");
+ fprintf(stderr, "About to nslog_uncork()\n");
nslog_uncork();
+ fprintf(stderr, "Uncorked now\n");
NSLOG(test, WARN, "argc=%d", argc);
+ for (int i = 0; i < argc; ++i)
+ NSLOG(test, WARN, "argv[%d] = %s", i, argv[i]);
return 0;
}