diff --git a/yotta/data/example-tls-client/main.cpp b/yotta/data/example-tls-client/main.cpp index 926b4837e..f97187ea6 100644 --- a/yotta/data/example-tls-client/main.cpp +++ b/yotta/data/example-tls-client/main.cpp @@ -256,19 +256,27 @@ protected: * Debug callback for mbed TLS * Just prints on the USB serial port */ - static void my_debug(void *ctx, int level, const char *str) + static void my_debug(void *ctx, int level, const char *file, int line, + const char *str) { + const char *p, *basename; (void) ctx; - (void) level; - printf("%s", str); + /* Extract basename from file */ + for(p = basename = file; *p != '\0'; p++) { + if(*p == '/' || *p == '\\') { + basename = p + 1; + } + } + + printf("%s:%04d: |%d| %s", basename, line, level, str); } /** * Certificate verification callback for mbed TLS * Here we only use it to display information on each cert in the chain */ - static int my_verify(void *data, mbedtls_x509_crt *crt, int depth, int *flags) + static int my_verify(void *data, mbedtls_x509_crt *crt, int depth, uint32_t *flags) { char buf[1024]; (void) data;