Re: Proposal for 2.8: Glog

Dnia 04-05-2005, śro o godzinie 00:11 +0300, Tor Lillqvist napisał(a):
> A tracing facility would be nice. I have suggested such earlier. Do
> you have a pointer to some on-line documentation on Glog's features?
> (Is that its current name, or a proposed new name?)

Eventually it shouldn't have any name at all, being just part of
glib :). Glog is temporary name for move between GStreamer and Glib.
Docs you can see here:

just replace GST_DEBUG with GLOG

> At least for my needs, the following features would be essential
> (i.e., I have at times hacked together stuff like this manually by
> adding code temporarily to sources I've been debugging):
> - It should be possible to redirect the output of each process, or
> each thread even, to a separate file. The trace file names could be
> configurable. For instance so that a %p would expand to the pid, %t
> thread id, %n to the process name. Etc.

Installing custom handler should give you that, at least partially.
About % expansion, I think it'd need some hacking on (some are already
there) custom printf() specifiers, this is however glibc-specific.

> - The format of each line could have optional parts: at least source
> file name, line number, process id, thread id, timestamp (with
> settable precision). Possibly things like cpu usage, system call
> count, etc. (Maybe that is overdoing it.)

It has most of those parts, and you can supply your own format string.

> - In case several threads output traces to the same file, it would be
> essential that each line is written atomically. Is it enough that each
> line is written using one write() system call (on Unix) to achieve
> this? Presumably not, so some locking must be used.

GStreamer is multithreaded, so that obviously has been taken into
account. As far as I can read from the code, there is locking done to
ensure proper serialisation.

> - On Win32, maybe it should be selectable to direct the output to
> OutputDebugString(). On Unix, to syslog().

Install custom log handler.

> - Trace invokations in the source code should be very
> non-intrusive. Some very short macro call with no parameters if you
> just want a basic line with no specific information, just a basic
> where and when.

How about GLOG_LOG("Message")? :)


Maciej Katafiasz <ml mathrick org>

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