diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-06-10 18:11:25 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-06-10 18:11:25 +0100 |
commit | 551cf378a93588d42732983ec30716e14afef945 (patch) | |
tree | 0e8e261afb40a4a7f137408546bdaeb63d2e3eb1 /test/basic.c | |
download | libnslog-551cf378a93588d42732983ec30716e14afef945.tar.gz libnslog-551cf378a93588d42732983ec30716e14afef945.tar.bz2 |
Initial version
Diffstat (limited to 'test/basic.c')
-rw-r--r-- | test/basic.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/basic.c b/test/basic.c new file mode 100644 index 0000000..fd40633 --- /dev/null +++ b/test/basic.c @@ -0,0 +1,33 @@ +/* + * Copyright 2017 Daniel Silverstone <dsilvers@netsurf-browser.org> + * + * This file is part of libnslog. + * + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + */ + +#include "nslog/nslog.h" + +#include <stdio.h> + +NSLOG_DEFINE_CATEGORY(test, "Test category"); + +static void test_render_function(void *ctx, nslog_entry_t *log) +{ + (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); +} + +int main(int argc, char **argv) +{ + nslog_set_render_callback(test_render_function, NULL); + nslog_uncork(); + NSLOG(test, WARN, "argc=%d", argc); + return 0; +} |