VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
DtOutputLogger 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.

Public Member Functions

 DtOutputLogger (const std::string &filename, int &globalThreshold, int threshold=0)
 
 ~DtOutputLogger ()
 
void operator() (const char *s,...)
 
void operator() (const std::string &s,...)
 
void operator() (const DtString &s,...)
 
bool resetLog ()
 
const std::string & filename () const
 
bool setFilename (const std::string &newFilename)
 
int threshold () const
 
void setThreshold (int threshold)
 
const intglobalThreshold () const
 
bool testInvariant () const
 

Private Member Functions

 DtOutputLogger (const DtOutputLogger &orig)
 
const DtOutputLoggeroperator= (const DtOutputLogger &orig)
 

Private Attributes

DtFilePrinter * myFilePrinter
 
DtOutputStreamBuffer * myBuffer
 
DtOutputStream * myLogger
 
intmyGlobalThreshold
 
int myThreshold
 
std::string myFilename
 

Constructor & Destructor Documentation

DtOutputLogger::DtOutputLogger ( const std::string &  filename,
int globalThreshold,
int  threshold = 0 
)

default constructor

DtOutputLogger::~DtOutputLogger ( )

destructor

DtOutputLogger::DtOutputLogger ( const DtOutputLogger orig)
private

copy constructor and assignment operator - not implemented

Member Function Documentation

void DtOutputLogger::operator() ( const char s,
  ... 
)

Logs the specified information, if the file is/was opened successfully.

void DtOutputLogger::operator() ( const std::string &  s,
  ... 
)
void DtOutputLogger::operator() ( const DtString s,
  ... 
)
bool DtOutputLogger::resetLog ( )

Closes the log file and reopens it, overwriting the existing file.

const std::string& DtOutputLogger::filename ( ) const

Returns the name of the file currently being logged to.

bool DtOutputLogger::setFilename ( const std::string &  newFilename)

Closes the current log if any, and opens a new file with the specified name.

Returns
a boolean signifying success or failure.
int DtOutputLogger::threshold ( ) const
void DtOutputLogger::setThreshold ( int  threshold)
const int& DtOutputLogger::globalThreshold ( ) const
bool DtOutputLogger::testInvariant ( ) const
const DtOutputLogger& DtOutputLogger::operator= ( const DtOutputLogger orig)
private

Member Data Documentation

DtFilePrinter* DtOutputLogger::myFilePrinter
private

The file printer to log to.

DtOutputStreamBuffer* DtOutputLogger::myBuffer
private

The buffer used by the output stream.

DtOutputStream* DtOutputLogger::myLogger
private

The output stream that does all the work.

int& DtOutputLogger::myGlobalThreshold
private

The threshold to measure against. If this is less than the threshold, then do not log anything.

int DtOutputLogger::myThreshold
private

The current logging threshold for the logger. If the logger's threshold is > the global threshold, it will not log anything.

std::string DtOutputLogger::myFilename
private

the original filename to log to


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

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)