Implement common logging function
When used as a library, it's desirable to be able to suppress logging,
or pipe logging through a different path. This commit changes behavior
such that logging is disabled by default, and introduces 2 new methods,
cper_set_log_stdio and cper_set_log_custom.
These allow library integrators to specify their logging mode. In
practice, this also allows fuzzing to run faster by not printing errors
to the log.
Change-Id: I941476627bc9b8261ba5f6c0b2b2338fdf931dd2
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/cli-app/cper-convert.c b/cli-app/cper-convert.c
index 33c7af7..bb06be9 100644
--- a/cli-app/cper-convert.c
+++ b/cli-app/cper-convert.c
@@ -10,6 +10,7 @@
#include <libgen.h>
#include <limits.h>
#include <json.h>
+#include <libcper/log.h>
#include <libcper/cper-parse.h>
#include <libcper/json-schema.h>
@@ -19,6 +20,7 @@
int main(int argc, char *argv[])
{
+ cper_set_log_stdio();
//Print help if requested.
if (argc == 2 && strcmp(argv[1], "--help") == 0) {
print_help();