Re: glib message logging and AllocConsole

Allin Cottrell <[email protected]>
Newsgroups gmane.comp.video.gimp.windows.devel
Message-ID <[email protected]>
On Wed, 9 Oct 2002, Herman Bloggs wrote:

> I am working on a win32 Gtk app using the mingw compiler.  I have
> noticed that when ever glib uses the default logging handler, it
> makes a call to AllocConsole.  This ends up bringing up a console
> window in Win9x despite having linked with the -mwindows (and no
> -mconsole).

Yes, but unless you want to suppress all warning/error messages (that
is an option), the only way they can appear -- or perhaps I should say
the most straightforward way for them to appear -- is to pop up a
"console"  window.  It's very ugly, granted, but then it's trying to 
tell you that something has gone wrong.

Just "thinking out loud" here:  Wouldn't it be better if the default
were to pop up Windows message boxes rather than a "DOS box"?  '"GTK
is going nuts!" <OK>'.  But a problem with this is that when things go
badly wrong you can get a huge spew of repetitive error messages: so
which would you rather have: an ugly "console" showing the list of
errors, or the desktop littered with dozens of message boxes all
saying the same thing, each one demanding to be dismissed with a mouse
click?

I'd say, first option is to tune your code so you don't get
errors/warnings.  Second line of defence, if you're sure the warnings 
are misleading or somehow don't really matter, suppress them with a 
dummy log handler.

void dummy_output_handler (const gchar *log_domain,
                           GLogLevelFlags log_level,
                           const gchar *message,
                           gpointer user_data)
{
    return;
}

Allin Cottrell.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.