diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-13 11:46:18 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-13 11:53:12 +0300 |
commit | 47442d9f526c7118b56c7cd963862256a3154a54 (patch) | |
tree | 5fa56d34d151f0aef5979ab6d7cc34f8a22a6bc2 /lib/utils/printf.c | |
parent | 22cbcd55f0446e4fc75d54a136e8d3a791d2b722 (diff) | |
download | micropython-47442d9f526c7118b56c7cd963862256a3154a54.tar.gz micropython-47442d9f526c7118b56c7cd963862256a3154a54.zip |
lib/utils/printf: Rework overriding printer of DEBUG_printf().
By default it uses mp_plat_print, but a port may override it to another
value with MICROPY_DEBUG_PRINTER_DEST.
Diffstat (limited to 'lib/utils/printf.c')
-rw-r--r-- | lib/utils/printf.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/utils/printf.c b/lib/utils/printf.c index 136056a3e2..308525b6e8 100644 --- a/lib/utils/printf.c +++ b/lib/utils/printf.c @@ -59,14 +59,11 @@ int vprintf(const char *fmt, va_list ap) { int DEBUG_printf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); - #if defined(MICROPY_DEBUG_STDERR) && MICROPY_DEBUG_STDERR - // Printing debug to stderr may give a chance tests which - // check stdout to pass, etc. - extern const mp_print_t mp_stderr_print; - int ret = mp_vprintf(&mp_stderr_print, fmt, ap); - #else - int ret = mp_vprintf(&mp_plat_print, fmt, ap); + #ifndef MICROPY_DEBUG_PRINTER_DEST + #define MICROPY_DEBUG_PRINTER_DEST mp_plat_print #endif + extern const mp_print_t MICROPY_DEBUG_PRINTER_DEST; + int ret = mp_vprintf(&MICROPY_DEBUG_PRINTER_DEST, fmt, ap); va_end(ap); return ret; } |