Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2002-04-09 13:55:15


> TRACE(MyTopic, LEVEL_STATUS) << "SessionID=" << SessionID << ", State=" << State << ...;
>
> The Stream() member function returns a reference to a an ostream derived class that
> buffers the trace message. The content of this buffer (including additional information
> such as timestamp, filename, line number, thread ID, etc.) is sent to the trace sink(s)
> in the destructor of TraceMessage.

Nice.

> The "Topic" argument is a handle (opaque pointer) to a structure that contains
> information about the topic, such as current trace level of the topic, list of sinks etc.
> The Level argument is a value from 0...100 and thus checks as to whether to trace are
> very cheap (two indirections, integer comparison, and jump). We never conditionally
> remove tracing in the release build as the increased code size is far outweighed by the
> advantage of being able to diagnose systems at customer sites.

Yes, null stream isn't targeted at your problem. Our issue was never code size it was performance.
Interestingly I see no reason why null stream couldn't be used in conjunction with your macro for
those times that you want to get rid of all the tracing at build time.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk