[GRASS-dev] making grass modules less verbose

Glynn Clements glynn at gclements.plus.com
Tue Sep 19 13:22:23 EDT 2006


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>




More information about the grass-dev mailing list