[Top][All Lists]

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

[Gnash-dev] new logging system

From: Rob Savoye
Subject: [Gnash-dev] new logging system
Date: Sat, 11 Mar 2006 12:37:18 -0700
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051013)

I just rewrote the debug logging system in Gnash, replacing the old purely C style debugging with one from another GNU project I authored (GnuAE). This new logging system supports C "printf() style" and C++ "streams style", and they can be intermixed together as well. I then layered the older log_msg() log_error() on top of this code, while adding a log_warning() too. So now it's possible to do things like this:

        log_msg("Turn on the lights!\n");
        dbglogfile << "Hello World " << counter++ << " times!" << endl;

The main advantage of this new logging system is it optionally writes everything to disk, handles C++ objects, and supports multiple levels of verbosity. All output lines can optionally be timestamped as well, but I left this turned off for the log_msg() wrappers so they behave the same as always.

This system also supports a simple TRACE macro that hooks itself into the constructor/destructor to print "enter" or "return". This is enabled by putting a GNASH_REPORT_FUNCTION; in the top of a C++ method. These will only appear at the highest level of verbosity, which right now is 1. One other nice feature is it's possible to have multiple debug logs, and you can have things get always printed to the log, but optionally be printed to the screen.

This logging system is styled on the one we wrote for eCOS, and I think way superior to printfs... I'm so sick of having to add "c_str() just to print a string".

The current default is to always write the debug log to disk, I can change this if anyone wants. We should also decide if all output lines should be timestamped or not. The logfile gets written to the current directory, or your home directory when using the plugin.

        - rob -

reply via email to

[Prev in Thread] Current Thread [Next in Thread]