John A. Preston wrote:
I'm using grass via some java servlets and recently found out that
any G_percent() messages and others are sent to the stderr
(thanks to Glyn Clements).
While I have been able to program around this,
It makes my use of stderr a bit messy. I trap
all stderr messages and display them in a error log
(in RED). However now I have to modify this, and
try and determine which of them is a activity message
and which is a real GRASS command error or warning message.
Has there been any discussion on a standard syntax
for error and warning message (prefixed with ERROR
or WARNING, maybe) or on this whole topic.
There has been some discussion. I've suggested that error, warning and
status messages could be handled more consistently, and I'm fairly
sure that nobody actually objected.
Actually getting it implemented is another matter. However, one of the
main issues for 5.1/6.0 is a general clean-up of the code, and
handling of messages should be part of that.
Having said that, any error message generated by G_fatal_error() will
begin with "ERROR:", and any warning message generated by G_warning()
will begin with "WARNING:"[1].
However, some programs simply print messages to stderr (or even
stdout). Markus recently cleaned up the error handling in a number of
modules, but I don't expect that he will have fixed all of them.
[1] By default. The code in question has recently been
internationalised, so the strings could change depending upon locale
settings. However, the internationalisation is disabled unless you use
the --with-nls switch when configuring.
I would love to have the -q flag on all commands
but I don't know how much support there is for
that.
The idea of "common" options and flags has also been discussed in the
context of enhancing the GRASS parser but, again, no firm decisions
have been made.
--
Glynn Clements <glynn.clements@virgin.net>