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/meson.build b/meson.build
index 6a46f42..8c7319a 100644
--- a/meson.build
+++ b/meson.build
@@ -83,16 +83,19 @@
     json_c_dep = json_c.get_variable('json_c_dep')
 endif
 
+libcper_include = ['include']
+libcper_include_dir = include_directories(libcper_include, is_system: true)
+
+
 libcper_parse_sources += files(
     'base64.c',
     'common-utils.c',
     'cper-parse.c',
     'cper-utils.c',
     'ir-parse.c',
+    'log.c',
 )
 
-libcper_include = ['include']
-libcper_include_dir = include_directories(libcper_include, is_system: true)
 subdir('include')
 
 libcper_parse = library(
@@ -108,7 +111,7 @@
 )
 libcper_parse_dep = declare_dependency(
     include_directories: libcper_include_dir,
-    link_with: libcper_parse,
+    link_with: [libcper_parse],
 )
 
 libcper_generate_sources = [
@@ -123,7 +126,8 @@
     generator_section_sources,
     version: meson.project_version(),
     include_directories: libcper_include_dir,
-    dependencies: [libcper_parse_dep, json_c_dep],
+    dependencies: [json_c_dep],
+    link_with: [libcper_parse],
     install: true,
     install_dir: get_option('libdir'),
 )
@@ -144,7 +148,8 @@
         'cper-convert',
         'cli-app/cper-convert.c',
         include_directories: libcper_include_dir,
-        dependencies: [libcper_parse_dep, json_c_dep],
+        dependencies: [json_c_dep],
+        link_with: [libcper_parse, libcper_generate],
         install: true,
         install_dir: get_option('bindir'),
     )
@@ -154,7 +159,7 @@
         'generator/cper-generate-cli.c',
         edk_sources,
         include_directories: libcper_include_dir,
-        dependencies: [libcper_generate_dep],
+        link_with: [libcper_parse, libcper_generate],
         install: true,
         install_dir: get_option('bindir'),
     )