Public Types | |
enum | LF_Level { LL_none = 0, LL_error = 1, LL_warning = 2, LL_informational = 3, LL_debug = 4 } |
describes the different status levels used for the log file messages More... | |
Public Member Functions | |
OFLogFile (const char *filename, int flags=ios::app) | |
constructor, creates a log file of the specified name. | |
virtual | ~OFLogFile () |
destructor | |
ofstream & | lockFile (LF_Level level=LL_none, const char *module=NULL) |
acquires a lock on the log file stream and returns a reference to the stream. | |
void | unlockFile () |
releases the lock on the log file stream. | |
OFBool | good () |
checks whether log file could be created. | |
ostream & | getFile () |
returns a reference to the current log file stream. | |
void | writeMessage (const char *message, int indent=3) |
writes a message to the log file stream. | |
void | setFilter (LF_Level level) |
sets a filter to specify which messages are actually written to the log file. | |
LF_Level | getFilter () |
gets the currently active filter. | |
OFBool | checkFilter (LF_Level level) |
checks whether the current filter allows out of messages of the given status level. | |
Private Member Functions | |
OFLogFile (const OFLogFile &arg) | |
private undefined copy constructor | |
OFLogFile & | operator= (const OFLogFile &arg) |
private undefined assignment operator | |
Private Attributes | |
ofstream | File |
log file stream | |
LF_Level | Filter |
log message filter |
Protection for simultaneous access from different threads is implemented if the module is compiled with -D_REENTRANT.
Definition at line 49 of file oflogfil.h.
|
describes the different status levels used for the log file messages
Definition at line 55 of file oflogfil.h. |
|
constructor, creates a log file of the specified name. Use method good() to check whether the output file could be created.
Referenced by checkFilter(). |
|
checks whether the current filter allows out of messages of the given status level.
Definition at line 165 of file oflogfil.h. References Filter, LL_none, OFLogFile(), and operator=(). |
|
returns a reference to the current log file stream. This method neither locks nor unlocks the stream - the called must ensure that the stream is locked and unlocked appropriately.
Definition at line 120 of file oflogfil.h. References File. |
|
gets the currently active filter.
Definition at line 156 of file oflogfil.h. References Filter. |
|
checks whether log file could be created.
Definition at line 103 of file oflogfil.h. References File. |
|
acquires a lock on the log file stream and returns a reference to the stream. An optional header (incl. date, time, status level and module name) is automatically written to the stream if level is not LL_none.
|
|
sets a filter to specify which messages are actually written to the log file. There are five different levels (in ascending order): none, informational, warning, error, debug. All messages which belong to a 'lower' level are included in the higher levels, i.e. the level debug includes all messages. Since this method uses the class mutex the filter cannot be changed while the file access is locked.
Definition at line 142 of file oflogfil.h. References Filter. |
|
writes a message to the log file stream. Each line has an indentation of the specified number of spaces. This method neither locks nor unlocks the stream - the called must ensure that the stream is locked and unlocked appropriately.
|