[Geany-devel] GLib 2.32 and debug messages

Colomban Wendling lists.ban at xxxxx
Sun Jun 3 15:03:26 UTC 2012


Le 02/06/2012 13:16, Lex Trotman a écrit :
> On 2 June 2012 20:58, Colomban Wendling <lists.ban at herbesfolles.org> wrote:
>> Hi guys,
>>
>> Since GLib 2.32, log messages at levels INFO or DEBUG aren't output
>> unless G_MESSAGES_DEBUG environment variable is set to either "all" or
>> to include the domain the message comes from [1].
> 
> Environment variables should die, they are hidden dependencies that
> don't transport to user systems.

?  These environment variables are documented so why is it worst than a
configuration file somewhere?

>> The problem is that it breaks our `-v` option, since we simply turns on
>> outputting INFO-level messages.  So, we need a fix or a workaround,
>> something.  I see 2 solutions:
>>
>> 1) simply `g_setenv("G_MESSAGES_DEBUG", "all", TRUE)` when given `-v`
>> (e.g. around main.c:131, `if (app->debug_mode) g_setenv(...`)
> 
> Maybe do this for pending release ...

I did this.

>> 2) output everything ourselves in `handler_log()` (log.c:115) rather
>> than calling GLib's default handler.
>>
> 
> ... and this later for "proper" fix that allows us to tailor it as we
> need, unless this is very simple too.

Well.  It's easy to output something.  It's harder to output something
as useful as what the GLib handler can output, like including prgname,
pid & co, an doing so to the proper stream.  Not really hard, but not
trivial either.

>> [...]
>>
>>
>> PS: BTW, if I read the `handler_log()` correctly, we block *all*
>> messages when not in debug mode?  I mean, warnings, criticals and
>> everything.  Do we really want that?
> 
> Probably still want criticals IMHO.

Fixed, now we only hide info, debug and message log entries.

Cheers,
Colomban



More information about the Devel mailing list