#include <FileLogger.h>
Inheritance diagram for peon::FileLogger:
Public Member Functions | |
FileLogger (int log_flag=PEON_LOG_DEBUG) | |
Constructor. | |
~FileLogger () | |
Destructor. | |
bool | openLogStream (const String &strName) |
This method simply opens the file handle and prepares the log file for writing. | |
void | closeLogStream (void) |
This method is responsible for shutting down our logging and closing any file handles. | |
void | logInfo (const String &strObject, const String &strText) |
This method logs a string setting it to "Info" mode. | |
void | logDebug (const String &strObject, const String &strText) |
This method logs a string setting it to "Debug" mode. | |
void | logError (const String &strObject, const String &strText) |
This method logs a string setting it to "Error" mode. | |
void | logFatal (const String &strObject, const String &strText) |
This method logs a string setting it to "Fatal" mode. | |
Static Public Member Functions | |
static FileLogger & | getSingleton (void) |
Override standard Singleton retrieval. | |
static FileLogger * | getSingletonPtr (void) |
Override standard Singleton retrieval. | |
Protected Member Functions | |
void | writeToLogStream (const String &strText) |
This method is responsible for writing out text to our logfile. | |
Protected Attributes | |
std::ofstream | m_log_file |
the file handle | |
String | m_strLogName |
name of the file | |
int | m_logging_level |
our logging level or filter |
We COULD make this fancier (like a primitive Log4J solution) by perhaps creating a LogInterface superclass, which we can then derive FileLogger from. This would then allow us to also create an SMTPLogger or HTMLLogger for example (to output our log messages over SMTP or into a nice and purty HTML document).
I made derived it from the ISingleton object in order to be accessible pretty much everywhere in our game and/or Peon.
|
Constructor.
|
|
This method is responsible for shutting down our logging and closing any file handles.
|
|
Override standard Singleton retrieval.
Reimplemented from peon::ISingleton< FileLogger >. |
|
Override standard Singleton retrieval.
Reimplemented from peon::ISingleton< FileLogger >. |
|
This method logs a string setting it to "Debug" mode. It then compares it with the internal log setting to see if it should be recorded or not.
|
|
This method logs a string setting it to "Error" mode. It then compares it with the internal log setting to see if it should be recorded or not.
|
|
This method logs a string setting it to "Fatal" mode. It then compares it with the internal log setting to see if it should be recorded or not.
|
|
This method logs a string setting it to "Info" mode. It then compares it with the internal log setting to see if it should be recorded or not.
|
|
This method simply opens the file handle and prepares the log file for writing.
|
|
This method is responsible for writing out text to our logfile.
|