[GRASS-dev] making grass modules less verbose

Michael Barton michael.barton at asu.edu
Thu Sep 21 13:35:05 EDT 2006


This is great. One minor editorial change:

it should be --quiet, not --quite

Thanks for this very useful change.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton


> From: Jachym Cepicky <jachym.cepicky at centrum.cz>
> Date: Thu, 21 Sep 2006 13:43:46 +0200
> To: Glynn Clements <glynn at gclements.plus.com>
> Cc: <grass-dev at grass.itc.it>
> Subject: Re: [GRASS-dev] making grass modules less verbose
> 
> Dear developers,
> 
> third version of the patch + one new file makes GRASS modules to be
> verbose according to user's needs.
> 
> Currently, 3 levels of verbosity are defined:
> 
>     0: Modules will print only errors and warnings (using G_fatal_error and
>         G_warning)
>     1: Modules can show progres info (e.g. G_percent)
>     2: Modules will print all messages, which are usually not importand
>     (G_message)
> 
> Verbosity level is set via env. variable GRASS_VERBOSE
> 
> Two new flags have been added to each module (parser.c), which enables
> the user to set the verbosity level on demand:
> 
>     --verbose (--v): set verbosity level to maximum
>     --quite   (--q): set verbosity level to miminum
> 
> One new file (lib/gis/verbose.c) has new 3 functions:
> 
> int G_verbose() - returns actual verbosity level
> int G_verbose_max() - returns maximal level of verbosity (currently 2)
> int G_verbose_min() - returns minimal level of verbosity (currently 0)
> 
> Problem: I tryed to set env. variable like this:
> 
>         char buff[32];
>         sprintf(buff,"GRASS_VERBOSE=%d",G_verbose_max());
>         putenv(buff);
> 
> but it did not work :-( how to fix it ? (parser.c, lines 738, 750)
> 
> Looking forward to your comments
> 
> Jachym
> 
> 
> On Wed, Sep 20, 2006 at 09:38:44PM +0100, Glynn Clements wrote:
>> 
>> Jachym Cepicky wrote:
>> 
>>>> i think this is a nice idea.
>>>> Some modules are very verbose and with this approach a general
>>>> way is provided to handle this verbosity.
>>> 
>>> I prepared new patch (for current cvs version) which makes all modules
>>> be able to use --verbose flag or to set GRASS_VERBOSE env. variable.
>>> 
>>> G_message, G_warning and G_percent are now able to handle according to
>>> the user needs.
>> 
>> A few comments:
>> 
>> 1. G_warning() should not be affected; warnings should be displayed
>> regardless of the verbosity setting.
>> 
>> 2. I would provide a --quiet flag to allow verbosity to be disabled
>> for individual cases.
>> 
>> 3. I wouldn't check for a GRASS variable with G__getenv(), as you
>> can't override that on a per-process basis.
>> 
>> -- 
>> Glynn Clements <glynn at gclements.plus.com>
> 
> -- 
> Jachym Cepicky
> e-mail: jachym.cepicky at centrum.cz
> URL: http://les-ejk.cz
> GPG: http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc
> -----------------------------------------
> OFFICE:          
> GDF-Hannover
> Mengendamm 16d
> 30177 Hannover
> Germany
> e-mail: cepicky at gdf-hannover.de
> URL:    http://gdf-hannover.de
> Tel.:   +49 511-39088507




More information about the grass-dev mailing list