17void TUtil::LogInitialise()
20 TLogFile* logfile =
new TLogFile;
28 tm* time = gmtime( &seconds );
33 "Logs\\%s_%d%02d%02d_%02d_%02d_%02d.log",
34 ms_oToshiParams.szLogFileName,
49void TUtil::CreateTPStringPool()
52 ms_poStringPool =
new TPString8Pool*;
53 *ms_poStringPool =
TNULL;
56void TUtil::DestroyTPStringPool()
58 if ( ms_poStringPool )
60 delete ms_poStringPool;
61 ms_poStringPool =
TNULL;
74 va_start( args, a_szFormat );
75 formatString.
FormatV( a_szFormat, args );
78 pLogFile->Log(
LogType_Info, ms_oToshiParams.szLogAppName, ms_oToshiParams.szLogAppDirName, formatString.
Get() );
92 va_start( args, a_szFormat );
93 formatString.
FormatV( a_szFormat, args );
96 pLogFile->Log( a_eLogType, ms_oToshiParams.szLogAppName, ms_oToshiParams.szLogAppDirName, formatString.
Get() );
120 va_start( args, a_szFormat );
121 formatString.
FormatV( a_szFormat, args );
124 OutputDebugStringA( formatString.
Get() );
125 printf( formatString.
Get() );
131 Log(
"Changing log file." );
134 if ( pUtil->m_pCurrentLogFile )
136 pUtil->m_pCurrentLogFile->
Close();
139 pUtil->m_pCurrentLogFile = ( !a_pLogFile ) ? pUtil->m_pDefaultLogFile : a_pLogFile;
143 : m_LogEmitter( this )
145 m_pDefaultLogFile =
TNULL;
146 m_pCurrentLogFile =
TNULL;
151 ms_oToshiParams = a_rToshiParams;
154 CreateKernelInterface();
156 CreateTPStringPool();
162void TUtil::CreateKernelInterface()
170 ms_oGlobalMutex.Destroy();
189 for (
TINT j = 8; j > 0; j-- )
Logging system for the Toshi engine.
#define TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_END
T2FormatString< 256, T2StringTraits< TCHAR > > T2FormatString256
T2FormatString< 2048, T2StringTraits< TCHAR > > T2FormatString2048
#define crc32upd(crctab, crc, c)
Error Create(const TCHAR *fileName, const TCHAR *str2, TBOOL writeExisting)
void AllowIndentation(TBOOL a_bAllow)
void SetSimpleMode(TBOOL a_bEnable)
static void Uninitialise()
void Format(const CharType *a_szFormat,...)
constexpr CharType * Get()
void FormatV(const CharType *a_szFormat, va_list a_Args)
static TFORCEINLINE TKernelInterface * CreateSingleton(Args &&... args)
static TFORCEINLINE TBOOL IsSingletonCreated()
static TFORCEINLINE TUtil * GetSingleton()
static TFORCEINLINE TUtil * GetSingletonSafe()
static void TrimLog(const TCHAR *fileExtension, TSIZE trimTo)
static void Log(const TCHAR *a_szFormat,...)
static TEmitter< TUtil, TUtil::LogEvent > & GetLogEmitter()
static TBOOL ToshiCreate(const TOSHIParams &a_rToshiParams)
static void CRCInitialise()
static TLogFile * GetCurrentLogFile()
static TUINT32 CRC32(void *buffer, TUINT32 len)
static void LogConsole(const TCHAR *a_szFormat,...)
static TUINT32 s_aiCRC32LUT[(256)]
static void ToshiDestroy()
static void LogSet(TLogFile *a_logFile)