Added code to print FT_COMPONENT and Time Stamp

This commit is contained in:
Priyeshkkumar 2020-07-05 00:33:48 +05:30
parent bfe6d5218a
commit 0c793e381c
3 changed files with 46 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2020-07-04 Priyesh Kumar <priyeshkkumar@gmail.com>
* Added code to print FT_COMPONENT along with TimeStamp with each log
2020-07-04 Priyesh Kumar <priyeshkkumar@gmail.com>
* include/freetype/ftlogging.h: Added two functions `FT_Set_Log_Handler()`

View File

@ -111,6 +111,17 @@ FT_BEGIN_HEADER
#ifdef FT_DEBUG_LEVEL_TRACE
#define FT_LOGGING_TAG( x ) FT_LOGGING_TAG_( x )
#define FT_LOGGING_TAG_( x ) #x
/*function to add dlg tag*/
FT_BASE( void )
ft_add_tag( const char* tag );
FT_BASE( void )
ft_remove_tag( const char* tag );
/* we need two macros here to make cpp expand `FT_COMPONENT' */
#define FT_TRACE_COMP( x ) FT_TRACE_COMP_( x )
#define FT_TRACE_COMP_( x ) trace_ ## x
@ -119,7 +130,11 @@ FT_BEGIN_HEADER
do \
{ \
if ( ft_trace_levels[FT_TRACE_COMP( FT_COMPONENT )] >= level ) \
{ \
ft_add_tag( FT_LOGGING_TAG( FT_COMPONENT ) ); \
FT_Message varformat; \
ft_remove_tag( FT_LOGGING_TAG( FT_COMPONENT ) ); \
} \
} while ( 0 )
#else /* !FT_DEBUG_LEVEL_TRACE */

View File

@ -386,7 +386,7 @@ else
}
else
{
features = dlg_output_threadsafe /*| dlg_output_tags*/ ;
features = dlg_output_threadsafe | dlg_output_tags | dlg_output_time ;
}
dlg_generic_output_stream( ft_fileptr, features, origin, string,
@ -436,7 +436,33 @@ else
{
custom_output_handler = NULL;
}
FT_BASE_DEF( void )
ft_add_tag( const char* tag )
{
dlg_add_tag( tag, NULL );
}
FT_BASE_DEF( void )
ft_remove_tag( const char* tag )
{
dlg_remove_tag( tag, NULL );
}
#else /* ! FT_LOGGING */
FT_BASE_DEF( void )
ft_add_tag( const char* tag )
{
/* nothing */
}
FT_BASE_DEF( void )
ft_remove_tag( const char* tag )
{
/* nothing */
}
#endif /* FT_LOGGING */
/* END */