[GRASS-dev] making grass modules less verbose

Jachym Cepicky jachym.cepicky at centrum.cz
Tue Sep 19 13:35:09 EDT 2006


hi Glynn,

I fully agree with you. But how to do this the best way? Add new
parameter to the function? 

e.g.

    G_percent(row,nrows,2,module)

    so that 

    G_percent could call G_percent2(n,d,s,stderr,module->verbose)

Make G_percent(), G_debug() and G_message() read environment variable
GRASS_VERBOSE? I would say, this would be the best solution.

If nobody has any objection to this sollution, I will prepare next patch.

Jachym
    
On Tue, Sep 19, 2006 at 06:22:23PM +0100, Glynn Clements wrote:
> 
> Jachym Cepicky wrote:
> 
> > following patch makes GRASS modules able to use --verbose flag or set
> > GRASS_VERBOSE environment variable.
> > 
> > In the code:
> > 
> >         if (module->verbose)
> >                     printf("Blah, blah, blah, blah\n");
> > 
> > 
> > or
> > 
> >         if (module->verbose)
> >                     G_percent(row, nrows, 2);
> > 
> > I thing, that according to Eric Steven Raymond, if the program does
> > not have anything interesting to say, it should say nothing. This is
> > good for embeding GRASS in some web server application or for some scripts.
> > 
> > But how to use it in old GRASS modules, so that the number of modules,
> > which must be corrected by hand, is as low as possible? Do you thing,
> > this is useful? Shall I put apply this to cvs?
> 
> Personally, I would look to integrate this with G_message(),
> G_debug(), G_percent() etc. E.g. unless --verbose is used, or
> GRASS_MESSAGE_FORMAT is set, G_message() and G_percent() wouldn't
> print anything.
> 
> It shouldn't be up to individual modules to perform the checks. 
> Modules should unconditionally call G_message() etc and leave it up to
> the library to determine how to handle this.
> 
> -- 
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20060919/1962d4f5/attachment.bin


More information about the grass-dev mailing list