pingus-devel
[Top][All Lists]
Advanced

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

Creating custom debug streams


From: David Philippi
Subject: Creating custom debug streams
Date: Wed, 5 Jun 2002 14:12:49 +0200
User-agent: KMail/1.4.1

I've just checked what really is to do to create custom debug streams.
In fact, cout and cerr are nothing other then extern fostreams. So to create 
a new warning stream, it's sufficient to use simply:

ostream & warn() { return cout << "Insert some custom prefix"; }

If you put this code into a class and make the methods static, a simple 

#define pout debugging::warn()

would be enough. From there on it's easy to create arbitrary configuration 
mechanisms to change the behaviour of the debug streams.
The questions to the design I see are:

- Configurability: 
  - compile time [ sure *g* ]
  - start time (commandline arguments)  [ very probably usefull ]
  - runtime [ don't know ]

- Number of custom streams
  - debug
  - warn
  - trace
  - profiling
  - component specific

- Capabilities:
  - prefix with some text (could also mean special controlcodes)
  - redirect to stdout / stderr / file / other stream (multiplexing)
  - mask out

Bye David




reply via email to

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