logger gets initialized now

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40286
This commit is contained in:
Borja Ferrer 2007-01-11 01:11:24 +00:00
parent 8ec61eecbf
commit f30dfedeeb
4 changed files with 25 additions and 1 deletions

View File

@ -3,6 +3,17 @@
CLogger g_Logger;
void CLogger::OnSourceModStartup(bool late)
{
//:TODO: read these options from a file, dont hardcode them
InitLogger(LoggingMode_PerMap, true);
}
void CLogger::OnSourceModAllShutdown()
{
CloseLogger();
}
void CLogger::_NewMapFile()
{
if (!m_Active)

View File

@ -23,10 +23,13 @@ enum LoggingMode
LoggingMode_HL2
};
class CLogger
class CLogger : public SMGlobalClass
{
public:
CLogger() : m_ErrMapStart(false), m_Active(false), m_DelayedStart(false), m_DailyPrintHdr(false) {}
public: //SMGlobalClass
void OnSourceModStartup(bool late);
void OnSourceModAllShutdown();
public:
void InitLogger(LoggingMode mode, bool startlogging);
void CloseLogger();

View File

@ -42,6 +42,13 @@ public:
virtual void OnSourceModShutdown()
{
}
/**
* @brief Called after SourceMod is completely shutted down
*/
virtual void OnSourceModAllShutdown()
{
}
private:
SMGlobalClass *m_pGlobalClassNext;
static SMGlobalClass *head;

View File

@ -6,6 +6,7 @@
#include <sh_string.h>
#include "PluginSys.h"
#include "ShareSys.h"
#include "CLogger.h"
SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool);
@ -157,6 +158,8 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch
m_IsMapLoading = true;
m_IsLateLoadInMap = false;
g_Logger.MapChange(pMapName);
DoGlobalPluginLoads();
m_IsMapLoading = false;