|
From: <eg...@us...> - 2007-05-17 09:23:56
|
Revision: 470
http://svn.sourceforge.net/opengate/?rev=470&view=rev
Author: egore
Date: 2007-05-17 02:23:30 -0700 (Thu, 17 May 2007)
Log Message:
-----------
Some fine piece of cake ... erm ... documentation
Modified Paths:
--------------
branches/ogsector/src/LogManager.cpp
branches/ogsector/src/LogManager.h
Modified: branches/ogsector/src/LogManager.cpp
===================================================================
--- branches/ogsector/src/LogManager.cpp 2007-05-17 09:04:06 UTC (rev 469)
+++ branches/ogsector/src/LogManager.cpp 2007-05-17 09:23:30 UTC (rev 470)
@@ -79,24 +79,23 @@
}
void LogManager::info( const std::string & msg ){
- std::string logMsg( "INFO: " + msg );
+ std::string logMsg( "INFO: " + msg );
writeToConsole_( logMsg );
write_( logMsg );
}
void LogManager::debug( const std::string & msg ){
- std::string logMsg( "DEBUG: " + msg );
+ std::string logMsg( "DEBUG: " + msg );
write_( logMsg );
}
void LogManager::warn( const std::string & msg ){
- std::string logMsg( "WARNING: " + msg );
+ std::string logMsg( "WARNING: " + msg );
write_( logMsg );
}
void LogManager::fatal( const std::string & msg ){
- std::string logMsg( "FATAL: " + msg );
-
+ std::string logMsg( "FATAL: " + msg );
writeToConsole_( logMsg );
write_( logMsg );
}
@@ -114,9 +113,9 @@
if ( haveLogFile_ ) logFile_ << timeStamp() << ": " << msg << std::endl;
}
-LogManager & LogManager::getSingleton( ){
- assert( ms_Singleton );
- return ( *ms_Singleton );
+LogManager & LogManager::getSingleton( ){
+ assert( ms_Singleton );
+ return ( *ms_Singleton );
}
LogManager * LogManager::getSingletonPtr( ){
Modified: branches/ogsector/src/LogManager.h
===================================================================
--- branches/ogsector/src/LogManager.h 2007-05-17 09:04:06 UTC (rev 469)
+++ branches/ogsector/src/LogManager.h 2007-05-17 09:23:30 UTC (rev 470)
@@ -49,6 +49,17 @@
* setChatLogFile() ) and also if he has a file for session logging (see
* setLogFile() ). You can also add an OGConsole for the so called console
* logging (see setConsole()).
+ *
+ * Opengate also supports different levels of importance for the logging. These
+ * levels are handled like this:
+ * <table>
+ * <tr><td>Level</td><td>Persistent log</td><td>Session log (and stdout)</td><td>Console log</td><td>Description</td></tr>
+ * <tr><td>info</td><td> </td><td>X</td><td>X</td><td>General interesting information (i.e. "player connected")</td></tr>
+ * <tr><td>chat</td><td>X</td><td>X</td><td>X</td><td>Chat from and to other users</td></tr>
+ * <tr><td>debug</td><td> </td><td>X</td><td> </td><td>Messages that indicate internal things that might be interesting for developers</td></tr>
+ * <tr><td>warning</td><td> </td><td>X</td><td> </td><td>Messages interesting for developers</td></tr>
+ * <tr><td>fatal</td><td> </td><td>X</td><td>X</td><td>Messages when really bad things happen</td></tr>
+ * </table>
* \author Carsten <spo...@us... >
*/
class LogManager : public Ogre::Singleton< LogManager > {
@@ -66,22 +77,31 @@
/*! Use the given OGConsole console to write the logs to it \param console The given OGConsole */
void setConsole( OGConsole * console );
+ /*! Create a timestamp \return A timestamp in the format [YYYY.MM.DD-HH.MM.SS] */
std::string timeStamp();
+ /*! Protocol a message with info-level importance */
void info( const std::string & msg );
+ /*! Protocol a chat-message */
void chat( const std::string & name, const std::string & msg );
+ /*! Protocol a message with debug-level importance */
void debug( const std::string & msg );
+ /*! Protocol a message with warn-level importance */
void warn( const std::string & msg );
+ /*! Protocol a message with fatal-level importance */
void fatal( const std::string & msg );
+ /*! TODO: Do we really need that? All messages should go into a logfile. */
void cout( const std::string & msg );
+ /*! This method returns the single instance of the LogManager */
static LogManager & getSingleton( void );
+ /*! This method return a pointer to the single instance of the LogManager */
static LogManager * getSingletonPtr( void );
// LogManager & operator - ( LogType type );
@@ -90,15 +110,25 @@
// LogManager & operator << ( const Flush & flush );
protected:
+
+ /*! This method writes the given message to stdout and (if available) to a logfile */
void write_( const std::string & msg );
+
+ /*! This method writes the given message to the console */
void writeToConsole_( const std::string & msg );
+ /*! Handle to the session log file */
std::ofstream logFile_;
+ /*! Handle to the persistent log file */
std::ofstream chatLogFile_;
+ /*! Handle to the console log */
OGConsole *console_;
+ /*! True, if we have a session log file */
bool haveLogFile_;
+ /*! True, if we have a persistent log file */
bool haveChatLogFile_;
+ /*! True, if we have a console log */
bool haveConsole_;
// LogType logType_;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|