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

Print only the basename from the file, and print level too.
parent acecb653
......@@ -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 );
}
......
......@@ -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 );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment