[GRASS-dev] [GRASS GIS] #312: wxNVIZ prints debug to terminal

#312: wxNVIZ prints debug to terminal
----------------------+-----------------------------------------------------
Reporter: msieczka | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: minor | Milestone: 6.4.0
Component: wxGUI | Version: svn-develbranch6
Keywords: | Platform: All
      Cpu: All |
----------------------+-----------------------------------------------------
E.g. at raster load time it pollutes the terminal with:

{{{
  Loading raster map <erode.index@PERMANENT>...
Loading raster map <erode.index@PERMANENT>...
Translating colors from raster map <erode.index@PERMANENT>...
   99%
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/312&gt;
GRASS GIS <http://grass.osgeo.org>

#312: wxNVIZ prints debug to terminal
-----------------------+----------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: minor | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: digitizer | Platform: All
      Cpu: All |
-----------------------+----------------------------------------------------
Changes (by neteler):

  * keywords: => digitizer
  * version: svn-develbranch6 => svn-releasebranch64
  * milestone: 6.4.0 => 6.4.3

Comment:

This is still an issue for the wxdigitizer (not debug but suer
messages):
{{{
GRASS 6.4.3svn (nc_spm_08):~ >
GRASS_INFO_PERCENT: 0
GRASS_INFO_PERCENT: 100

GRASS_INFO_PERCENT: 0
GRASS_INFO_PERCENT: 12
GRASS_INFO_PERCENT: 25
GRASS_INFO_PERCENT: 37
GRASS_INFO_PERCENT: 50
GRASS_INFO_PERCENT: 62
GRASS_INFO_PERCENT: 75
GRASS_INFO_PERCENT: 87
GRASS_INFO_PERCENT: 100

GRASS_INFO_MESSAGE(10737,1): Building topology for vector map <ciao>...
GRASS_INFO_END(10737,1)

GRASS_INFO_MESSAGE(10737,2): Registering primitives...
GRASS_INFO_END(10737,2)

GRASS_INFO_MESSAGE(10737,3): 6 primitives registered
GRASS_INFO_END(10737,3)

GRASS_INFO_MESSAGE(10737,4): 18 vertices registered
GRASS_INFO_END(10737,4)

GRASS_INFO_MESSAGE(10737,5): Building areas...
GRASS_INFO_END(10737,5)

GRASS_INFO_PERCENT: 16
GRASS_INFO_PERCENT: 33
GRASS_INFO_PERCENT: 50
GRASS_INFO_PERCENT: 66
GRASS_INFO_PERCENT: 83
GRASS_INFO_PERCENT: 100

GRASS_INFO_MESSAGE(10737,6): 3 areas built
GRASS_INFO_END(10737,6)

GRASS_INFO_MESSAGE(10737,7): 1 isles built
GRASS_INFO_END(10737,7)

GRASS_INFO_MESSAGE(10737,8): Attaching islands...
GRASS_INFO_END(10737,8)

GRASS_INFO_PERCENT: 100

GRASS_INFO_MESSAGE(10737,9): Attaching centroids...
GRASS_INFO_END(10737,9)

GRASS_INFO_PERCENT: 16
GRASS_INFO_PERCENT: 33
GRASS_INFO_PERCENT: 50
GRASS_INFO_PERCENT: 66
GRASS_INFO_PERCENT: 83
GRASS_INFO_PERCENT: 100

GRASS_INFO_MESSAGE(10737,10): Number of nodes: 4
GRASS_INFO_END(10737,10)

GRASS_INFO_MESSAGE(10737,11): Number of primitives: 6
GRASS_INFO_END(10737,11)

GRASS_INFO_MESSAGE(10737,12): Number of points: 0
GRASS_INFO_END(10737,12)

GRASS_INFO_MESSAGE(10737,13): Number of lines: 0
GRASS_INFO_END(10737,13)

GRASS_INFO_MESSAGE(10737,14): Number of boundaries: 6
GRASS_INFO_END(10737,14)

GRASS_INFO_MESSAGE(10737,15): Number of centroids: 0
GRASS_INFO_END(10737,15)

GRASS_INFO_MESSAGE(10737,16): Number of areas: 3
GRASS_INFO_END(10737,16)

GRASS_INFO_MESSAGE(10737,17): Number of isles: 1
GRASS_INFO_END(10737,17)

GRASS_INFO_MESSAGE(10737,18): Number of areas without centroid: 3
GRASS_INFO_END(10737,18)
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/312#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#312: wxNVIZ prints debug to terminal
-----------------------+----------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: minor | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: digitizer | Platform: All
      Cpu: All |
-----------------------+----------------------------------------------------

Comment(by neteler):

Still an issue.

Does anyone know how to intercept GRASS_INFO_MESSAGE() etc to avoid that
it gets
printed to the terminal?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/312#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#312: wxNVIZ prints debug to terminal
-----------------------+----------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: minor | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: digitizer | Platform: All
      Cpu: All |
-----------------------+----------------------------------------------------

Comment(by glynn):

Replying to [comment:2 neteler]:
> Does anyone know how to intercept GRASS_INFO_MESSAGE() etc to avoid that
it gets
> printed to the terminal?

export GRASS_MESSAGE_FORMAT=silent

Alternatively, identify the G_message() calls and change them to
G_verbose_message() so that they don't get printed without --verbose.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/312#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#312: wxNVIZ prints debug to terminal
-----------------------+----------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: minor | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: digitizer | Platform: All
      Cpu: All |
-----------------------+----------------------------------------------------

Comment(by wenzeslaus):

Replying to [comment:3 glynn]:
> Replying to [comment:2 neteler]:
> > Does anyone know how to intercept GRASS_INFO_MESSAGE() etc to avoid
that it gets
> > printed to the terminal?
>
> export GRASS_MESSAGE_FORMAT=silent
>
> Alternatively, identify the G_message() calls and change them to
G_verbose_message() so that they don't get printed without --verbose.

I don't understand the issue very well. Does this mean that we need to
change all `G_message()` calls in the library if there is a chance that
the part will be used directly by some GUI application (vdigit, nviz,
iclass)?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/312#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#312: wxNVIZ prints debug to terminal
-----------------------+----------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: minor | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: digitizer | Platform: All
      Cpu: All |
-----------------------+----------------------------------------------------

Comment(by glynn):

Replying to [comment:4 wenzeslaus]:

> > Alternatively, identify the G_message() calls and change them to
G_verbose_message() so that they don't get printed without --verbose.
>
> I don't understand the issue very well. Does this mean that we need to
change all `G_message()` calls in the library if there is a chance that
the part will be used directly by some GUI application (vdigit, nviz,
iclass)?

First, should GUI programs be different to non-GUI programs in this
regard?

The issue is that library functions are generating messages, meaning that
any program which uses those functions will generate messages. It's
debatable whether library functions have enough context to decide which
messages are appropriate.

Vlib is particularly noisy in this regard. I count 113 calls to
G_message() in lib/*/*.c (excluding test suites). 59 of those (more than
half) are in Vlib.

The other issue seems to be that GUI-format messages are being written to
the terminal, which suggests an issue in the way that the program is
started (i.e. something is executing it with GRASS_MESSAGE_FORMAT=gui but
not capturing its output; the point of GRASS_MESSAGE_FORMAT=gui is to use
a machine-readable format so that a GUI can process the messages).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/312#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>