diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-06-10 20:48:38 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-06-10 20:48:38 +0100 |
commit | 8052642eadfb95b244f978b10889dff51f9133f5 (patch) | |
tree | c8287316266cf98b5886cbef2fa5a44551d40982 /test/basic.c | |
parent | 551cf378a93588d42732983ec30716e14afef945 (diff) | |
download | libnslog-8052642eadfb95b244f978b10889dff51f9133f5.tar.gz libnslog-8052642eadfb95b244f978b10889dff51f9133f5.tar.bz2 |
Rework to only allocate one thing in the corked state and nothing in the uncorked state
Diffstat (limited to 'test/basic.c')
-rw-r--r-- | test/basic.c | 22 |
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; } |