[GRASS-dev] Vect_build() & verbosity

Hamish hamish_nospam at yahoo.com
Wed Feb 28 03:54:41 EST 2007


Martin Landa wrote:
> I would like to make V_build() fn verbose sensitive, i.e. to print
> information about building topology only on the standard or higher
> verbosity level. E.g. in lib/vector/Vlib/build.c:int printmsg()
> 
> if ( Msgout != NULL && G_verbose() >= G_verbose_std()) {
> ...
> }
> 
> There is related issue, some of modules print V_build() output to
> stdout (33) and some to stderr (40). I think all modules (except of
> v.build) should send V_build() output information to stderr.

you are talking about changing the vector lib API, which is a much bigger
deal than just tweaking progress messages.

lib/vector/Vlib/build.c
/*!
 \fn int Vect_build ( struct Map_info *Map, FILE *msgout ) 
 \brief build topology for vector map
 \return 1 on success, 0 on error
 \param Map_info structure, file for message output (stdout/stderr for example) or NULL
*/


We need to know why that was chosen before we change it to:
 int Vect_build ( struct Map_info *Map )

A solution in Vect_build() where verbosity is only used if msgout=stderr
is ugly; adding verbosity control to stdout log messages is most likely
a bug.

FWIW, I too would like to see Vect_built() observe the verbosity controls,
using --quiet should work. But I also think it is often very helpful to see
that output, if all build features are count=0, you know very quickly that
you made a mistake.


Martin Landa wrote:
> just to summarize, I suggest to reduce verbosity levels to three levels:
> 
> --q 0 MIN_LEVEL (only warnings + fatal_errors)
>      1 STD_LEVEL (progress information)
> --v  2 MAX_LEVEL (any "useful" information, another points is what is "useful")
> 
> E.g. Vect_build () output:
> 
> 0 ... nothing printed
> 1 ... Registering lines: ... , etc.
> 2 ... all current info
> 
> Three level are enough I think, then we should move selected messages
> to G_debug (1, ).
> 
> Any objections (in case I missed something)?

Yes, I prefer to keep an option open between normal and silent.

e.g. my recent (but very short lived) modification of g.rename,
verbosity: --quiet is completely quiet.
           GRASS_VERBOSE=1 shows only map names.
           normal and --verbose show map names and elements.

It is nice to have that control if we want it, and it doesn't hurt any.
I think Radim had the right approach with G_debug(), standard debug levels
at 1,3,5. It leaves space for expansion. So I'd prefer we used 1,3,5 for
message levels instead of 0,1,2. They symmetry with G_debug() is nice too.


Glynn:
> On a related note, I would appreciate some way to disable percentage
> output separately from other messages. My usual terminal (XEmacs'
> shell-mode) doesn't support ^H, so the G_percent() output is garbage.

We could expand on GRASS_MESSAGE_FORMAT=gui and add
GRASS_MESSAGE_FORMAT=flat which would just print "Done.\n"
(or nothing if used with --quiet) for use with G_percent() and G_clicker().


Jáchym Èepický wrote:
> --verbose is here to set temporary GRASS_VERBOSE to heigher level, if
> it is set to 0 or 1
>
> so it makes sence to have it, but Im not sure, if it makes sence to
> have it in the help message na all the manual pages..

Me neither (help pages and command line --help output). We already have
silent parser flags (--html-description,...). Maybe just mention to use
it in the help page of the few modules that do use a verbose mode?
shrug.



Hamish




More information about the grass-dev mailing list