diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 773bca6db..98f8528ae 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -315,9 +315,14 @@ static void my_debug( void *ctx, int level, const char *file, int line, const char *str ) { - ((void) level); + const char *p, *basename; - mbedtls_fprintf( (FILE *) ctx, "%s:%04d: %s", file, line, str ); + /* Extract basename from file */ + for( p = basename = file; *p != '\0'; p++ ) + if( *p == '/' || *p == '\\' ) + basename = p + 1; + + mbedtls_fprintf( (FILE *) ctx, "%s:%04d: |%d| %s", basename, line, level, str ); fflush( (FILE *) ctx ); } diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index a08aa9b29..fb5c42fd9 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -394,9 +394,14 @@ static void my_debug( void *ctx, int level, const char *file, int line, const char *str ) { - ((void) level); + const char *p, *basename; - mbedtls_fprintf( (FILE *) ctx, "%s:%04d: %s", file, line, str ); + /* Extract basename from file */ + for( p = basename = file; *p != '\0'; p++ ) + if( *p == '/' || *p == '\\' ) + basename = p + 1; + + mbedtls_fprintf( (FILE *) ctx, "%s:%04d: |%d| %s", basename, line, level, str ); fflush( (FILE *) ctx ); }