VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Attributes
makVrv::DtDebugLog Class Reference

This is a simple class for logging information to a file. More...

Inheritance diagram for makVrv::DtDebugLog:
Inheritance graph
[legend]

Public Types

enum  PrintLevel { Warning = 1, Information = 2, Debug = 4, PrintLevel_End = 5 }

Public Member Functions

 DtDebugLog (const std::string &filename)
 default constructor
virtual ~DtDebugLog ()
 DTOR.
bool levelWillPrint (DtDebugLog::PrintLevel alevel)
 Check to see if the provided level would print with the current level.
virtual void setLevel (DtDebugLog::PrintLevel alevel)
 Set the output level.
virtual void setOutputStream (DtOutputStream *stream)
 Set the output stream.
virtual DtDebugLog::PrintLevel level ()
 Get the output level.
std::ostream & out (DtDebugLog::PrintLevel level=DtDebugLog::Information)
 Get the log output.
DtOutputStream * outputStream ()
 Get the output stream.

Protected Attributes

PrintLevel myLevel
 variable used to decide whether send output to the 'works always' stream (myOutput) or the 'works never' stream (myEmptyOutput)
DtFilePrinter * myFilePrinter
 The file printer to log to.
DtOutputStreamBuffer * myBuffer
 The buffer used by the output stream.
DtOutputStreamBuffer * myEmptyBuffer
 The buffer used by the empty output stream.
int myPrintLevelThresholdRef
 The dummy 'global notify level' that our DtOutputStream's will compare their configured thresholds to.
DtOutputStream * myOutput
 The output stream that does all the work.
std::ostream * myEmptyOutput
 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.

Detailed Description

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.

Note
If the file already exists, it will be overwritten if writable. If the file cannot be opened, then no error is returned - output will just not be logged.

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.

Note
The filename must not be an empty string.

Member Enumeration Documentation

Enumerator:
Warning 
Information 
Debug 
PrintLevel_End 

Constructor & Destructor Documentation

makVrv::DtDebugLog::DtDebugLog ( const std::string &  filename)

default constructor

virtual makVrv::DtDebugLog::~DtDebugLog ( )
virtual

DTOR.

Member Function Documentation

bool makVrv::DtDebugLog::levelWillPrint ( DtDebugLog::PrintLevel  alevel)
inline

Check to see if the provided level would print with the current level.

References makVrv::vrvTacticalGraphicUtilities::level().

virtual void makVrv::DtDebugLog::setLevel ( DtDebugLog::PrintLevel  alevel)
virtual

Set the output level.

virtual void makVrv::DtDebugLog::setOutputStream ( DtOutputStream *  stream)
virtual

Set the output stream.

virtual DtDebugLog::PrintLevel makVrv::DtDebugLog::level ( )
virtual

Get the output level.

std::ostream& makVrv::DtDebugLog::out ( DtDebugLog::PrintLevel  level = DtDebugLog::Information)
inline

Get the log output.

References makVrv::vrvTacticalGraphicUtilities::level().

DtOutputStream* makVrv::DtDebugLog::outputStream ( )

Get the output stream.

Member Data Documentation

PrintLevel makVrv::DtDebugLog::myLevel
protected

variable used to decide whether send output to the 'works always' stream (myOutput) or the 'works never' stream (myEmptyOutput)

DtFilePrinter* makVrv::DtDebugLog::myFilePrinter
protected

The file printer to log to.

DtOutputStreamBuffer* makVrv::DtDebugLog::myBuffer
protected

The buffer used by the output stream.

DtOutputStreamBuffer* makVrv::DtDebugLog::myEmptyBuffer
protected

The buffer used by the empty output stream.

int makVrv::DtDebugLog::myPrintLevelThresholdRef
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).

DtOutputStream* makVrv::DtDebugLog::myOutput
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.

std::ostream* makVrv::DtDebugLog::myEmptyOutput
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.


The documentation for this class was generated from the following file:

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)