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 Member Functions | Private Member Functions | Private Attributes
DtOutputLogger Class Reference

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

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 intglobalThreshold () 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.
intmyGlobalThreshold
 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

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 Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)