Cosmetics in debug in ssl_{client,server}2.c

Print only the basename from the file, and print level too.
This commit is contained in:
Manuel Pégourié-Gonnard 2015-07-01 11:50:23 +02:00
parent acecb653d5
commit 052f28853b
2 changed files with 14 additions and 4 deletions

View file

@ -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 );
}

View file

@ -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 );
}