Re: Glib logging disable patch



Alexander Larsson <alla lysator liu se> writes:

> On Fri, 29 Dec 2000, Tim Janik wrote:
> 
> > apart from that, could you say _why_ disabling all logging
> > functions is so important? is this about saving the the
> > actually logging strings? in that case, couldn't we at least
> > leave something like the stringified file name plus a line
> > number integer to give at least a minor hint as to where
> > something went wrong?
> 
> This is mainly a size thing yes. I've been measuring this a bit today.
> For a non-debug build of glib and gtk+ doing minimal logging (like you
> describe above) saves 39k. Doing no logging at all saves another 19k.

Out of what total size? That's relevant if we are going to worry about
60k.

[ I'd expect you should be able to save most of that 19k by doing filename + linenumber as:

 __FILE__ ": %d", __LINE__

instead of:

 __FILE__ ": %d" G_STRINGIFY(__LINE__)

as done in G_STRLOC. ]
 
> Shall i add a minimal logging option, a no logging option, both or none?

My basic opinion here is that I don't think that redefining g_log()
and friends to do nothing is the appropriate way of doing things.
When I call g_log(), I should be able to expect that either it
outputs something or gets redirected through the g_log() system.

g_warning() might be covering multiple things:

 - programmer errors
 - really bad things happening at runtime (missing files, or whatever)

I think your main original main target was things like the
warning in gtk_text_iter_make_surreal - which are basically
verbose substtutes for a g_return_if_fail() meant to be more
useful for a programmer. So, maybe we should simply have 
something like:

 g_debug_critical ("Invalid text buffer iterator: either the iterator "
                   ...)

That specifically identifies these warnings as targets for chopping.
We could even do it as:
 
 g_debug_critical ("Invalid text buffer iterator",
                   "either the iterator..");

Providing a summary and an expanded message. But presumably turning
these off would be done along with G_DISABLE_CHECKS, so probably
replacing the error message with simply:

 g_error ("Failed at " __FILE__ "%d", __LINE__);

Or even simply abort(), would be fine.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]