VR-Forces Developer's Guide
 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. 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.
Inheritance diagram for makVrv::DtDebugLog:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

 DtDebugLog (const std::string &filepath, bool attachGlobalLogStreams=true)
 
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
 

Member Enumeration Documentation

Enumerator
Fatal 
Warning 
Information 
Debug 
PrintLevel_End 

Constructor & Destructor Documentation

makVrv::DtDebugLog::DtDebugLog ( const std::string &  filepath,
bool  attachGlobalLogStreams = true 
)

default constructor

Parameters
filepathThe file path for the debug log
attachGlobalLogStreamsWhether or not to attach global log streams (DtFatal, DtWarn, DtInfo, DtVerbose, DtDebug)
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 Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)