[GRASS-dev] [bug #4524] (grass) v.clean, v.patch (else?): output to stderr instead of stdout...

Hamish wrote (Mon, Jul 10 2006 11:24:12):

The correct solution IMO is to relegate overly verbose messages to
G_debug(1,) or a -v verbose flag, and continue to send warnings and
errors to stderr.

> > Patch complete. 2 files patched.

in effect G_done_msg().

> > Intersections at borders will have to be snapped.
> > Lines common between files will have to be edited.
> > The header information also may have to be edited.

These 3 are somewhere between needing Warnings and boldface type in the
help page. (hence G_message())

The question might be reduced to "where to send G_message()?" ?

Anywhere but stdout, I think.

Example reason: I don't want somebody using my v.flip (a script that calls
v.patch, among the others) to be confused with v.patch information that:

# Intersections at borders will have to be snapped.
# Lines common between files will have to be edited.
# The header information also may have to be edited.

Because I have taken care of this for the user, knowing what the input for
v.patch is and using 'v.clean tool=snap' as needed. That information above is
simply wrong and confusing the user, when v.patch is a script component.

Maciek

-------------------------------------------- Managed by Request Tracker

> The question might be reduced to "where to send G_message()?" ?

Anywhere but stdout, I think.

Example reason: I don't want somebody using my v.flip (a script that
calls v.patch, among the others) to be confused with v.patch
information that:

# Intersections at borders will have to be snapped.
# Lines common between files will have to be edited.
# The header information also may have to be edited.

Because I have taken care of this for the user, knowing what the input
for v.patch is and using 'v.clean tool=snap' as needed. That
information above is simply wrong and confusing the user, when v.patch
is a script component.

No a general solution, but for your script perhaps you could use
"grep -v" or sed to filter out the unwanted messages (after redirecting
stderr to stdout as needed)?

Hamish