Log file writer.
List of all members.
Public Member Functions
| ||Log (OSystem *system)|
| ||Constructor for the logger object. |
| ||~Log ()|
|void ||open (Common::WriteStream *stream)|
| ||Opens a new log file. |
|void ||close ()|
| ||Closes the current log file. |
|void ||print (const char *message, const bool printTimeOnNewline=true)|
| ||Prints a message to the log stream. |
Private Member Functions
|void ||printTimeStamp ()|
| ||Prints a time stamp in the form: "[YYYY-MM-DD HH:MM:SS] ". |
|OSystem * ||_system|
| ||The OSystem instance used to query data like the time. |
|Common::WriteStream * ||_stream|
| ||Where to write the output too. |
| ||Whether we are at the start of a line. |
Log file writer.
This can be used by the backends to implement file logging functionality.
Definition at line 42 of file log.h.
Constructor & Destructor Documentation
Constructor for the logger object.
|system ||The OSystem instance to use. Must be non-null. |
Definition at line 34 of file log.cpp.
Definition at line 50 of file log.h.
Member Function Documentation
Closes the current log file.
This function will output a line saying that the log was closed successfully. This can be used to check whether a log is incomplete because of whatever reasons.
Definition at line 55 of file log.cpp.
Opens a new log file.
The previous log, which was handled by this logger, will be closed before the new stream is associated.
The current implemention will always call flush after data is written to the log file. It might thus be wise to pass an unbuffered write stream here to avoid unnecessary overhead.
- See also:
Calling open with stream being 0 is valid and will result in the same behavior as calling close, but it may have additional overhead.
- See also:
This function will output information about the ScummVM version and the features built into ScummVM automatically. It will also add a short notice to indicate that the log was opened successfully.
|stream ||Stream where to output the log contents. Note that the stream will be deleted by the logger. |
Definition at line 39 of file log.cpp.
||const char *
|| printTimeOnNewline = |
Prints a message to the log stream.
This has optional support to output a timestamp on every new line. The timestamp will look like: "[YYYY-MM-DD HH:MM:SS] ". Printing of a timestamp is done by default.
It might be noteworthy that this function does not append a new line to the given message.
In case no stream is associated with this logger, this function will quit immediatly.
|message ||The message to write. |
|printTimeOnNewline ||Whether to print a timestamp on the start of a new line. |
Definition at line 65 of file log.cpp.
Prints a time stamp in the form: "[YYYY-MM-DD HH:MM:SS] ".
Definition at line 94 of file log.cpp.
Member Data Documentation
Whether we are at the start of a line.
Definition at line 122 of file log.h.
Where to write the output too.
Definition at line 117 of file log.h.
The OSystem instance used to query data like the time.
Definition at line 112 of file log.h.
The documentation for this class was generated from the following files: