Re: Glib logging disable patch



On 2 Jan 2001, Owen Taylor wrote:

>
> 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.

Out of 2.4 Meg, meaning it is only 2.5% of the total size. For glib only
the ratio is 5% (most of it in gobject).

> [ I'd expect you should be able to save most of that 19k by doing filename + linenumber as:
>
>  __FILE__ ": %d", __LINE__

This is what i used. Anything else would be stupid.

> > 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.

Yes. This sounds about right. I'll look into it.

/ Alex






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