VR-Forces 4.0.4 Class Documentation
Public Member Functions | Private Member Functions | Private Attributes
DtOutputLogger Class Reference

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

List of all members.

Public Member Functions

 DtOutputLogger (const std::string &filename, int &globalThreshold, int threshold=0)
 default constructor
 ~DtOutputLogger ()
 destructor
void operator() (const char *s,...)
 Logs the specified information, if the file is/was opened successfully.
void operator() (const std::string &s,...)
void operator() (const DtString &s,...)
bool resetLog ()
 Closes the log file and reopens it, overwriting the existing file.
const std::string & filename () const
 Returns the name of the file currently being logged to.
bool setFilename (const std::string &newFilename)
 Closes the current log if any, and opens a new file with the specified name.
int threshold () const
void setThreshold (int threshold)
const int & globalThreshold () const
bool testInvariant () const

Private Member Functions

 DtOutputLogger (const DtOutputLogger &orig)
 copy constructor and assignment operator - not implemented
const DtOutputLoggeroperator= (const DtOutputLogger &orig)

Private Attributes

DtFilePrinter * myFilePrinter
 The file printer to log to.
DtOutputStreamBuffer * myBuffer
 The buffer used by the output stream.
DtOutputStream * myLogger
 The output stream that does all the work.
int & myGlobalThreshold
 The threshold to measure against.
int myThreshold
 The current logging threshold for the logger.
std::string myFilename
 the original filename to log to

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.

Constructor & Destructor Documentation

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

default constructor

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,
  ... 
)

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.
void DtOutputLogger::setThreshold ( int  threshold)
const int& DtOutputLogger::globalThreshold ( ) 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.

The threshold to measure against.

If this is less than the threshold, then do not log anything.

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 Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)