#include <object.h>
Public Types | |
enum | Options { Blocks = 1, DateAndTime = 2, Timestamp = 4, Thread = 8, TraceLevel = 16, FileAndLine = 32, ThreadAddress = 64, AppendToFile = 128, GMTTime = 256, SystemLogStream = 32768 } |
Options for trace output. More... | |
Static Public Member Functions | |
void | Initialise (unsigned level, const char *filename=NULL, unsigned options=Timestamp|Thread|Blocks) |
void | SetOptions (unsigned options) |
void | ClearOptions (unsigned options) |
unsigned | GetOptions () |
void | SetLevel (unsigned level) |
unsigned | GetLevel () |
BOOL | CanTrace (unsigned level) |
void | SetStream (ostream *out) |
ostream & | Begin (unsigned level, const char *fileName, int lineNum) |
ostream & | End (ostream &strm) |
|
Options for trace output.
|
|
Begin a trace output. If the trace stream output is used outside of the provided macros, it should be noted that a mutex is obtained on the call to #PBeginTrace# which will prevent any other threads from using the trace stream until the #PEndTrace# function is called. So a typical usage would be: {verbatim} ostream & s = PTrace::Begin(3, __FILE__, __LINE__); s << "hello"; if (want_there) s << " there"; s << '!' << PTrace::End(); {verbatim}
|
|
Determine if the level may cause trace output. This checks against the current global trace level set by #PSetTraceLevel# for if the trace output may be emitted. This is used by the PTRACE macro.
|
|
Clear the trace options. The PTRACE(), PTRACE_BLOCK() and PTRACE_LINE() macros output trace text that may contain assorted values. These are defined by the Options enum. Note this function AND's the complement of the bits included in the options parameter.
|
|
End a trace output. If the trace stream output is used outside of the provided macros, the #PEndTrace# function must be used at the end of the section of trace output. A mutex is obtained on the call to #PBeginTrace# which will prevent any other threads from using the trace stream until the PEndTrace. The #PEndTrace# is used in a similar manner to #::endl# or #::flush#. So a typical usage would be: {verbatim} ostream & s = PTrace::Begin(); s << "hello"; if (want_there) s << " there"; s << '!' << PTrace::End(); {verbatim}
|
|
Get the trace level. The PTRACE() macro checks to see if its level is equal to or lower then the level set by this function. If so then the trace text is output to the trace stream. |
|
Get the current trace options. The PTRACE(), PTRACE_BLOCK() and PTRACE_LINE() macros output trace text that may contain assorted values. These are defined by the Options enum. |
|
Set the most common trace options. If filename is not NULL then a PTextFile is created and attached the trace output stream. This object is never closed or deleted until the termination of the program. A trace output of the program name version and OS is written as well. |
|
Set the trace level. The PTRACE() macro checks to see if its level is equal to or lower then the level set by this function. If so then the trace text is output to the trace stream.
|
|
Set the trace options. The PTRACE(), PTRACE_BLOCK() and PTRACE_LINE() macros output trace text that may contain assorted values. These are defined by the Options enum. Note this function OR's the bits included in the options parameter.
|
|
Set the stream to be used for trace output. This stream is used for all trace output using the various trace functions and macros.
|