build/core: Add 'nolog' build option to omit logging entirely

This can be used to avoid dereferencing the global `log_type`
which may be inaccessible on platforms with memory protection.

Change-Id: Ib48468018e3afaf05978018199a9a2022cb49fdf
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/libmctp-log.h b/libmctp-log.h
index 1e574e5..d2b5899 100644
--- a/libmctp-log.h
+++ b/libmctp-log.h
@@ -5,9 +5,24 @@
 
 /* libmctp-internal logging */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef MCTP_NOLOG
+
+__attribute__((format(printf, 2, 3))) static inline void
+mctp_prlog(int level __unused, const char *fmt __unused, ...)
+{
+}
+
+#else
+
 void mctp_prlog(int level, const char *fmt, ...)
 	__attribute__((format(printf, 2, 3)));
 
+#endif
+
 #ifndef pr_fmt
 #define pr_fmt(x) x
 #endif