rename vips_diag() as vips_info()
plus a command-line flag to turn it on
This commit is contained in:
parent
5f340ea554
commit
6855770362
@ -7,6 +7,7 @@
|
||||
- added vips_error_freeze() / vips_error_thaw()
|
||||
- used freeze() / thaw() to stop file format sniffers logging spurious errors
|
||||
- vipsthumbnail uses embedded jpg thumbnails if it can
|
||||
- rename vips_diag() as vips_info(), add --vips-info flag
|
||||
|
||||
3/7/13 started 7.34.2
|
||||
- lower priority for Matlab load to reduce segvs from Mat_Open(), thanks
|
||||
|
8
TODO
8
TODO
@ -1,11 +1,3 @@
|
||||
- support webp, see:
|
||||
|
||||
https://github.com/jcupitt/libvips/issues/68
|
||||
|
||||
- rename vips_diag() as vips_info(), make it work like a log thing ...
|
||||
normally no output, can be turned on with a --vips-verbose flag
|
||||
|
||||
handy with vipsthumbnail
|
||||
|
||||
- what's the difference between buildlut and invertlut? can we make invertlut
|
||||
by just swapping the channels before calling buildlut?
|
||||
|
@ -123,7 +123,7 @@ vips_sequential_generate( VipsRegion *or,
|
||||
g_thread_self(), r->top, r->height );
|
||||
|
||||
if( sequential->trace )
|
||||
vips_diag( class->nickname,
|
||||
vips_info( class->nickname,
|
||||
"request for line %d, height %d",
|
||||
r->top, r->height );
|
||||
|
||||
|
@ -52,9 +52,9 @@ void vips_error_g( GError **error );
|
||||
void vips_warn( const char *domain, const char *fmt, ... )
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
void vips_vwarn( const char *domain, const char *fmt, va_list ap );
|
||||
void vips_diag( const char *domain, const char *fmt, ... )
|
||||
void vips_info( const char *domain, const char *fmt, ... )
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
void vips_vdiag( const char *domain, const char *fmt, va_list ap );
|
||||
void vips_vinfo( const char *domain, const char *fmt, va_list ap );
|
||||
|
||||
void vips_error_exit( const char *fmt, ... )
|
||||
__attribute__((noreturn, format(printf, 1, 2)));
|
||||
|
@ -83,6 +83,10 @@ extern int vips__progress;
|
||||
*/
|
||||
extern int vips__leak;
|
||||
|
||||
/* Show info messages. Handy for debugging.
|
||||
*/
|
||||
extern int vips__info;
|
||||
|
||||
/* A string giving the image size (in bytes of uncompressed image) above which
|
||||
* we decompress to disc on open.
|
||||
*/
|
||||
|
@ -196,8 +196,8 @@ extern "C" {
|
||||
#define im_error_clear vips_error_clear
|
||||
#define im_warn vips_warn
|
||||
#define im_vwarn vips_vwarn
|
||||
#define im_diag vips_diag
|
||||
#define im_vdiag vips_vdiag
|
||||
#define im_diag vips_info
|
||||
#define im_vdiag vips_vinfo
|
||||
#define error_exit vips_error_exit
|
||||
|
||||
#define im_get_argv0 vips_get_argv0
|
||||
|
@ -105,6 +105,10 @@
|
||||
* supposed to indicate the component which failed.
|
||||
*/
|
||||
|
||||
/* Show info messages. Handy for debugging.
|
||||
*/
|
||||
int vips__info = 0;
|
||||
|
||||
/* Make global array to keep the error message buffer.
|
||||
*/
|
||||
#define VIPS_MAX_ERROR (10240)
|
||||
@ -112,9 +116,6 @@ static char vips_error_text[VIPS_MAX_ERROR] = "";
|
||||
static VipsBuf vips_error_buf = VIPS_BUF_STATIC( vips_error_text );
|
||||
static int vips_error_freeze_count = 0;
|
||||
|
||||
#define IM_DIAGNOSTICS "IM_DIAGNOSTICS"
|
||||
#define IM_WARNING "IM_WARNING"
|
||||
|
||||
/**
|
||||
* vips_error_freeze:
|
||||
*
|
||||
@ -347,25 +348,26 @@ vips_error_clear( void )
|
||||
}
|
||||
|
||||
/**
|
||||
* vips_vdiag:
|
||||
* @domain: the source of the diagnostic message
|
||||
* vips_vinfo:
|
||||
* @domain: the source of the message
|
||||
* @fmt: printf()-style format string for the message
|
||||
* @ap: arguments to the format string
|
||||
*
|
||||
* Sends a formatted diagnostic message to stderr. If you define the
|
||||
* environment variable IM_DIAGNOSTICS, these message are surpressed.
|
||||
* Sends a formatted informational message to stderr if the --vips-info flag
|
||||
* has been given to the program or the environment variable IM_INFO has been
|
||||
* set.
|
||||
*
|
||||
* Diagnostic messages are used to report details about the operation of
|
||||
* Informational messages are used to report details about the operation of
|
||||
* functions.
|
||||
*
|
||||
* See also: vips_diag(), vips_warn().
|
||||
* See also: vips_info(), vips_warn().
|
||||
*/
|
||||
void
|
||||
vips_vdiag( const char *domain, const char *fmt, va_list ap )
|
||||
vips_vinfo( const char *domain, const char *fmt, va_list ap )
|
||||
{
|
||||
if( !g_getenv( IM_DIAGNOSTICS ) ) {
|
||||
if( vips__info ) {
|
||||
g_mutex_lock( vips__global_lock );
|
||||
(void) fprintf( stderr, _( "%s: " ), _( "vips diagnostic" ) );
|
||||
(void) fprintf( stderr, _( "%s: " ), _( "vips info" ) );
|
||||
if( domain )
|
||||
(void) fprintf( stderr, _( "%s: " ), domain );
|
||||
(void) vfprintf( stderr, fmt, ap );
|
||||
@ -375,7 +377,7 @@ vips_vdiag( const char *domain, const char *fmt, va_list ap )
|
||||
}
|
||||
|
||||
/**
|
||||
* vips_diag:
|
||||
* vips_info:
|
||||
* @domain: the source of the diagnostic message
|
||||
* @fmt: printf()-style format string for the message
|
||||
* @Varargs: arguments to the format string
|
||||
@ -389,12 +391,12 @@ vips_vdiag( const char *domain, const char *fmt, va_list ap )
|
||||
* See also: vips_vdiag(), vips_warn().
|
||||
*/
|
||||
void
|
||||
vips_diag( const char *domain, const char *fmt, ... )
|
||||
vips_info( const char *domain, const char *fmt, ... )
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, fmt );
|
||||
vips_vdiag( domain, fmt, ap );
|
||||
vips_vinfo( domain, fmt, ap );
|
||||
va_end( ap );
|
||||
}
|
||||
|
||||
@ -409,12 +411,12 @@ vips_diag( const char *domain, const char *fmt, ... )
|
||||
*
|
||||
* Warning messages are used to report things like overflow counts.
|
||||
*
|
||||
* See also: vips_diag(), vips_warn().
|
||||
* See also: vips_info(), vips_warn().
|
||||
*/
|
||||
void
|
||||
vips_vwarn( const char *domain, const char *fmt, va_list ap )
|
||||
{
|
||||
if( !g_getenv( IM_WARNING ) ) {
|
||||
if( !g_getenv( "IM_WARNING" ) ) {
|
||||
g_mutex_lock( vips__global_lock );
|
||||
(void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) );
|
||||
if( domain )
|
||||
@ -439,7 +441,7 @@ vips_vwarn( const char *domain, const char *fmt, va_list ap )
|
||||
*
|
||||
* Warning messages are used to report things like overflow counts.
|
||||
*
|
||||
* See also: vips_diag(), vips_vwarn().
|
||||
* See also: vips_info(), vips_vwarn().
|
||||
*/
|
||||
void
|
||||
vips_warn( const char *domain, const char *fmt, ... )
|
||||
|
@ -228,6 +228,11 @@ vips_init( const char *argv0 )
|
||||
bindtextdomain( GETTEXT_PACKAGE, name );
|
||||
bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" );
|
||||
|
||||
/* Default info setting from env.
|
||||
*/
|
||||
if( g_getenv( "IM_INFO" ) )
|
||||
vips__info = 1;
|
||||
|
||||
/* Register base vips types.
|
||||
*/
|
||||
(void) vips_image_get_type();
|
||||
@ -408,6 +413,9 @@ vips_set_fatal_cb( const gchar *option_name, const gchar *value,
|
||||
}
|
||||
|
||||
static GOptionEntry option_entries[] = {
|
||||
{ "vips-info", 0, G_OPTION_FLAG_HIDDEN,
|
||||
G_OPTION_ARG_NONE, &vips__info,
|
||||
N_( "show informative messages" ), NULL },
|
||||
{ "vips-fatal", 0, G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
|
||||
G_OPTION_ARG_CALLBACK, (gpointer) &vips_set_fatal_cb,
|
||||
N_( "abort on first error or warning" ), NULL },
|
||||
|
Loading…
x
Reference in New Issue
Block a user