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.has...@linaro.org>
Reviewed-by: Taras Kondratiuk <taras.kondrat...@linaro.org>
---
v2: Fixed indentation (forgot to checkpatch v1)
v3: Removed ODP_UNUSED for level as it's now used

 platform/linux-generic/odp_weak.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_weak.c 
b/platform/linux-generic/odp_weak.c
index 7fa5955..f4336f0 100644
--- a/platform/linux-generic/odp_weak.c
+++ b/platform/linux-generic/odp_weak.c
@@ -10,13 +10,24 @@
 #include <odp/hints.h>
 
 ODP_WEAK_SYMBOL ODP_PRINTF_FORMAT(2, 3)
-int odp_override_log(odp_log_level_e level ODP_UNUSED, const char *fmt, ...)
+int odp_override_log(odp_log_level_e level, 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;
-- 
2.1.1


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to