block annoying INFO messages on some older glibs
Some old glibs can display INFO messages by default. Block these ourselves. See https://github.com/libvips/libvips/issues/1876
This commit is contained in:
parent
4de9b56725
commit
1686725117
|
@ -5,6 +5,7 @@
|
|||
- fix out of bounds read in tiffload
|
||||
- fix tiffsave region shrink mode [imgifty]
|
||||
- add missing flushes on write to target [harukizaemon]
|
||||
- hide info messages you could get with some older glibs [kleisauke]
|
||||
|
||||
6/9/20 started 8.10.2
|
||||
- update magicksave/load profile handling [kelilevi]
|
||||
|
|
|
@ -284,6 +284,24 @@ empty_log_handler( const gchar *log_domain, GLogLevelFlags log_level,
|
|||
{
|
||||
}
|
||||
|
||||
#if !GLIB_CHECK_VERSION( 2, 31, 0 )
|
||||
static void
|
||||
default_log_handler( const gchar *log_domain, GLogLevelFlags log_level,
|
||||
const gchar *message, gpointer user_data )
|
||||
{
|
||||
if( log_level & (G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO) ) {
|
||||
const char *domains = g_getenv( "G_MESSAGES_DEBUG" );
|
||||
|
||||
if( !domains ||
|
||||
(!g_str_equal( domains, "all" ) &&
|
||||
!g_strrstr( domains, log_domain )) )
|
||||
return;
|
||||
}
|
||||
|
||||
g_log_default_handler( log_domain, log_level, message, user_data );
|
||||
}
|
||||
#endif /*!GLIB_CHECK_VERSION( 2, 31, 0 )*/
|
||||
|
||||
/* Attempt to set a minimum stacksize. This can be important on systems with a
|
||||
* very low default, like musl.
|
||||
*/
|
||||
|
@ -318,17 +336,12 @@ set_stacksize( guint64 size )
|
|||
static void
|
||||
vips_verbose( void )
|
||||
{
|
||||
/* Older glibs were showing G_LOG_LEVEL_{INFO,DEBUG} messages
|
||||
* by default
|
||||
*/
|
||||
#if GLIB_CHECK_VERSION ( 2, 31, 0 )
|
||||
const char *old;
|
||||
|
||||
old = g_getenv( "G_MESSAGES_DEBUG" );
|
||||
|
||||
if( !old ) {
|
||||
if( !old )
|
||||
g_setenv( "G_MESSAGES_DEBUG", G_LOG_DOMAIN, TRUE );
|
||||
}
|
||||
else if( !g_str_equal( old, "all" ) &&
|
||||
!g_strrstr( old, G_LOG_DOMAIN ) ) {
|
||||
char *new;
|
||||
|
@ -338,7 +351,6 @@ vips_verbose( void )
|
|||
|
||||
g_free( new );
|
||||
}
|
||||
#endif /*GLIB_CHECK_VERSION( 2, 31, 0 )*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -590,6 +602,18 @@ vips_init( const char *argv0 )
|
|||
g_log_set_handler( G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
|
||||
empty_log_handler, NULL );
|
||||
|
||||
#if !GLIB_CHECK_VERSION( 2, 31, 0 )
|
||||
/* Older glibs can sometimes show G_LOG_LEVEL_{INFO,DEBUG} messages.
|
||||
* Block them ourselves. We test the env var inside the handler since
|
||||
* vips_verbose() can be toggled at runtime.
|
||||
*
|
||||
* Again, we should not call g_log_set_handler(), but this is the only
|
||||
* convenient way to fix this behaviour.
|
||||
*/
|
||||
g_log_set_handler( G_LOG_DOMAIN, G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG,
|
||||
default_log_handler, NULL );
|
||||
#endif /*!GLIB_CHECK_VERSION( 2, 31, 0 )*/
|
||||
|
||||
/* Set a minimum stacksize, if we can.
|
||||
*/
|
||||
if( (vips_min_stack_size = g_getenv( "VIPS_MIN_STACK_SIZE" )) )
|
||||
|
|
Loading…
Reference in New Issue