![]() |
VR-Forces Developer's Guide
|
This is a simple class for logging information to a file. To be used, the caller must specify a logging level as well as a global logging level. If the threshold is < the globalThreshold, then the output logger will output the specified information to the associated file, if the file was created successfully.
If the filename is reset at any point, then the currently open file is closed and a new file is opened with the specified name.

Public Types | |
| enum | PrintLevel { Warning = 1, Information = 2, Debug = 4, PrintLevel_End = 5 } |
Public Member Functions | |
| DtDebugLog (const std::string &filename) | |
| virtual | ~DtDebugLog () |
| bool | levelWillPrint (DtDebugLog::PrintLevel alevel) |
| virtual void | setLevel (DtDebugLog::PrintLevel alevel) |
| virtual void | setOutputStream (DtOutputStream *stream) |
| virtual DtDebugLog::PrintLevel | level () |
| std::ostream & | out (DtDebugLog::PrintLevel level=DtDebugLog::Information) |
| DtOutputStream * | outputStream () |
Protected Attributes | |
| PrintLevel | myLevel |
| DtFilePrinter * | myFilePrinter |
| DtOutputStreamBuffer * | myBuffer |
| DtOutputStreamBuffer * | myEmptyBuffer |
| int | myPrintLevelThresholdRef |
| DtOutputStream * | myOutput |
| std::ostream * | myEmptyOutput |
| makVrv::DtDebugLog::DtDebugLog | ( | const std::string & | filename | ) |
default constructor
|
virtual |
DTOR.
|
inline |
Check to see if the provided level would print with the current level.
References makVrv::vrvTacticalGraphicUtilities::level().
|
virtual |
Set the output level.
|
virtual |
Set the output stream.
|
virtual |
Get the output level.
|
inline |
Get the log output.
References makVrv::vrvTacticalGraphicUtilities::level().
| DtOutputStream* makVrv::DtDebugLog::outputStream | ( | ) |
Get the output stream.
|
protected |
variable used to decide whether send output to the 'works always' stream (myOutput) or
the 'works never' stream (myEmptyOutput)
|
protected |
The file printer to log to.
|
protected |
The buffer used by the output stream.
|
protected |
The buffer used by the empty output stream.
|
protected |
The dummy 'global notify level' that our DtOutputStream's will compare their configured thresholds to. We arbitrarily set this to 0 in the constructor, but it can be any int, really (except MAXINT, because we need to have one value higher than it).
|
protected |
The output stream that does all the work. When the stream is created, its threshold is set to myPrintLevelThresholdRef so its always less than or equal to it, making it a 'works always' output stream.
|
protected |
The 'black hole' output stream When the stream is created, its threshold is set to myPrintLevelThresholdRef+1 so its always greater than the reference, making it a 'works never' output stream.