diff mbox

linux-generic: only print errors to stderr

Message ID 1425557618-14771-1-git-send-email-stuart.haslam@linaro.org
State Accepted
Commit d1d882c698acbb701de12d50dea90c02b8b2c2d5
Headers show

Commit Message

Stuart Haslam March 5, 2015, 12:13 p.m. UTC
The default logger prints all log levels to stderr. To make things
easier when debugging failures change it to print only errors to stderr
and everything else to stdout.

Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 platform/linux-generic/odp_weak.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_weak.c b/platform/linux-generic/odp_weak.c
index 7fa5955..0a90ee6 100644
--- a/platform/linux-generic/odp_weak.c
+++ b/platform/linux-generic/odp_weak.c
@@ -14,9 +14,20 @@  int odp_override_log(odp_log_level_e level ODP_UNUSED, const char *fmt, ...)
 {
 	va_list args;
 	int r;
+	FILE *logfd;
+
+	switch (level) {
+		case ODP_LOG_ERR:
+		case ODP_LOG_UNIMPLEMENTED:
+		case ODP_LOG_ABORT:
+			logfd = stderr;
+			break;
+		default:
+			logfd = stdout;
+	}
 
 	va_start(args, fmt);
-	r = vfprintf(stderr, fmt, args);
+	r = vfprintf(logfd, fmt, args);
 	va_end(args);
 
 	return r;