ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Log file writer. More...

#include <log.h>

Collaboration diagram for Backends::Log::Log:

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] ".

Private Attributes

OSystem_system
 The OSystem instance used to query data like the time.
Common::WriteStream_stream
 Where to write the output too.
bool _startOfLine
 Whether we are at the start of a line.

Detailed Description

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

Backends::Log::Log::Log ( OSystem system  ) 

Constructor for the logger object.

Parameters:
system The OSystem instance to use. Must be non-null.

Definition at line 34 of file log.cpp.

Backends::Log::Log::~Log (  )  [inline]

Definition at line 50 of file log.h.


Member Function Documentation

void Backends::Log::Log::close (  ) 

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.

void Backends::Log::Log::open ( Common::WriteStream stream  ) 

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:
Common::WriteStream::flush

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:
close

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.

Parameters:
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.

void Backends::Log::Log::print ( const char *  message,
const bool  printTimeOnNewline = true 
)

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.

Parameters:
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.

void Backends::Log::Log::printTimeStamp (  )  [private]

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:


Generated on Sat Nov 9 2019 05:01:51 for ResidualVM by doxygen 1.7.1
curved edge   curved edge