[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[devel] Methods for debugging output in criawips
From: |
Sven Herzberg |
Subject: |
[devel] Methods for debugging output in criawips |
Date: |
Thu, 25 Nov 2004 12:52:15 +0100 |
Hi,
this is a notification for those who are hacking on criawips: We have
had the debug.h file in the src directory which provided g_debug in the
same way as the Glib 2.5.x does. This has lead to several "criawips
doesn't compile" reports that could have easily been solved by just
including debug.h.
The past days I had created a new place for cut-and-pasted code which
belongs to 'copy-src' now. Within copy-src there's a directory cdebug
which contains a debugging library I am working on. It's features should
be:
1. Don't put out ANY debugging information as long as noone asks
for it.
2. Request the output of debugging information by type. This should
be realized by parsing the content of an environment variable.
3. Define so-called contexts (e.g. "FooBarClass::bazFunction"),
which can be selected via environment variable ("Foo*" resulting
in the output of all information coming from classes starting
with "Foo")
4. Be able to disable the debugging stuff completely (like one can
do with -DG_DISABLE_ASSERT)
5. Be able to share this code across applications (not
criawips-specific code in there)
The basis API is finished, features 4 and 5 are already implemented, I
will start working on the other ones this afternoon. For you developers
the following things have changed:
1. Stop using g_debug (it's being used in cdebug internally)
2. Use the cdebug* function which work like this:
cdebug(gchar*, gchar*, ...)
cdebug("FooClass::barFunc()", "format-string", format-args) will
result in output like "FooClass::barFunc(): format-string"
To save typing and to make the system a lot more flexible (especially
wrt renaming classes) there are the following functions which create the
string before the double colon from the first argument:
cdebugc(GObjectClass*, gchar*, gchar*, ...);
cdebugo(GObject*, gchar*, gchar*, ...);
cdebugt(GType, gchar*, gchar*, ...);
So most of the g_debug code got replaced by me with statements like:
cdebugo(self, "functioName()", "Debugging %s", "Message");
Regards,
Sven
PS: This is just for those who wonder how to pull out debugging info.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [devel] Methods for debugging output in criawips,
Sven Herzberg <=