diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-11-23 18:47:12 +0100 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-11-23 18:47:12 +0100 |
commit | d7857c4a1abc46ed1c11513a4a44f633370b27b3 (patch) | |
tree | 8908376eb7005c10f987512405cef20a96fe2a06 | |
parent | 99faa9f979a85bee79f771eaca7e20a55a65c3d6 (diff) | |
download | embedlog-d7857c4a1abc46ed1c11513a4a44f633370b27b3.tar.gz embedlog-d7857c4a1abc46ed1c11513a4a44f633370b27b3.tar.bz2 embedlog-d7857c4a1abc46ed1c11513a4a44f633370b27b3.zip |
make embedlog print to stderr by default
-rw-r--r-- | examples/print-memory.c | 1 | ||||
-rw-r--r-- | examples/print-options.c | 1 | ||||
-rw-r--r-- | examples/print-simple.c | 10 | ||||
-rw-r--r-- | man/el_init.3 | 9 | ||||
-rw-r--r-- | man/el_overview.7 | 5 | ||||
-rw-r--r-- | pkg/test.c | 1 | ||||
-rw-r--r-- | src/el-options.c | 1 | ||||
-rw-r--r-- | tst/test-el-options.c | 2 |
8 files changed, 8 insertions, 22 deletions
diff --git a/examples/print-memory.c b/examples/print-memory.c index b4c5ce9..29c770c 100644 --- a/examples/print-memory.c +++ b/examples/print-memory.c @@ -19,7 +19,6 @@ int main(void) } el_init(); - el_option(EL_OUT, EL_OUT_STDERR); el_pmemory(ELI, ascii, sizeof(ascii)); el_pmemory(ELI, s, sizeof(s)); diff --git a/examples/print-options.c b/examples/print-options.c index 2c619cb..abfb05c 100644 --- a/examples/print-options.c +++ b/examples/print-options.c @@ -12,7 +12,6 @@ int main(void) struct el_options opts; el_init(); - el_option(EL_OUT, EL_OUT_STDERR); el_option(EL_PRINT_LEVEL, 0); el_print(ELI, "We can disable information about log level\b"); diff --git a/examples/print-simple.c b/examples/print-simple.c index d3b3956..17e062e 100644 --- a/examples/print-simple.c +++ b/examples/print-simple.c @@ -8,19 +8,13 @@ int main(void) { /* - * first we nned to initialize logger to known state + * first we nned to initialize logger to known state, embedlog + * will print to stdout by default */ el_init(); /* - * to use logger you need to enable at least one output, without it logs - * will be printed to /dev/null - */ - - el_option(EL_OUT, EL_OUT_STDERR); - - /* * now we can simply print messages like we would do it with ordinary * printf - we just need to log level macro as a first argument */ diff --git a/man/el_init.3 b/man/el_init.3 index ed8dc62..8b920e1 100644 --- a/man/el_init.3 +++ b/man/el_init.3 @@ -86,16 +86,13 @@ Note: error handling has been ommited for clarity sake el_init(); el_oinit(&opts); - /* make default logger to print to stderr */ - el_option(EL_OUT, EL_OUT_STDERR); - - /* make opts to print to file */ - el_ooption(&opts, EL_OUT, EL_OUT_STDERR); + /* make opts to print to file and stderr */ + el_ooption(&opts, EL_OUT, EL_OUT_FILE | EL_OUT_STDERR); el_ooption(&opts, EL_FPATH, "/tmp/test.log"); /* print messages */ el_print(ELI, "will print to stderr"); - el_oprint(ELI, &opts, "will print to file /tmp/test.log"); + el_oprint(ELI, &opts, "will print to file /tmp/test.log and stderr"); /* cleanup after any initialization code (like fopen) */ el_ocleanup(&opts); diff --git a/man/el_overview.7 b/man/el_overview.7 index 31791f9..1d47d3f 100644 --- a/man/el_overview.7 +++ b/man/el_overview.7 @@ -234,12 +234,9 @@ for more details. int main(void) { - /* initialize library */ + /* initialize library, default output is stderr */ el_init(); - /* tell logger to print onto stderr */ - el_option(EL_OUT, EL_OUT_STDERR); - /* print message with info severity */ el_print(ELI, "answer is %d", 42); @@ -13,7 +13,6 @@ int main(void) { el_init(); - el_option(EL_OUT, EL_OUT_STDERR); el_print(ELN, "embedlog works!"); el_cleanup(); return 0; diff --git a/src/el-options.c b/src/el-options.c index 9b72711..0646f56 100644 --- a/src/el-options.c +++ b/src/el-options.c @@ -392,6 +392,7 @@ int el_oinit VALID(EINVAL, options); memset(options, 0, sizeof(struct el_options)); + options->outputs = EL_OUT_STDERR; options->print_log_level = 1; options->print_newline = 1; options->level = EL_INFO; diff --git a/tst/test-el-options.c b/tst/test-el-options.c index 767b58f..40d129a 100644 --- a/tst/test-el-options.c +++ b/tst/test-el-options.c @@ -92,7 +92,7 @@ static void options_init(void) memset(&default_options, 0, sizeof(default_options)); - default_options.outputs = 0; + default_options.outputs = EL_OUT_STDERR; default_options.level = EL_INFO; default_options.file_sync_level = EL_FATAL; default_options.level_current_msg = EL_DBG; |