![]() |
VR-Forces 4.2 Class Documentation
|
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 int & | globalThreshold () const |
| bool | testInvariant () const |
Private Member Functions | |
| DtOutputLogger (const DtOutputLogger &orig) | |
| copy constructor and assignment operator - not implemented | |
| const DtOutputLogger & | operator= (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 | |
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.
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.
| DtOutputLogger::DtOutputLogger | ( | const std::string & | filename, |
| int & | globalThreshold, | ||
| int | threshold = 0 |
||
| ) |
default constructor
| DtOutputLogger::~DtOutputLogger | ( | ) |
destructor
|
private |
copy constructor and assignment operator - not implemented
| 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.
| int DtOutputLogger::threshold | ( | ) | const |
| void DtOutputLogger::setThreshold | ( | int | threshold | ) |
| const int& DtOutputLogger::globalThreshold | ( | ) | const |
| bool DtOutputLogger::testInvariant | ( | ) | const |
|
private |
|
private |
The file printer to log to.
|
private |
The buffer used by the output stream.
|
private |
The output stream that does all the work.
|
private |
The threshold to measure against.
If this is less than the threshold, then do not log anything.
|
private |
The current logging threshold for the logger.
If the logger's threshold is > the global threshold, it will not log anything.
|
private |
the original filename to log to