My Project
|
It is a singleton class that is tightly integrated to the game engine. More...
#include <FileLogger.h>
Public Member Functions | |
bool | LoadLogFromFile (const char *filename) |
Add new entries from file. More... | |
bool | SaveLogToFile (const char *filename) |
save all logs to file. | |
bool | BeginFileLog () |
it will hook the CParaFile interface and record each read file operation. More... | |
void | EndFileLog () |
it will unhook the CParaFile interface and stop recording each read file operation. More... | |
void | AddFile (const char *filename, bool bReadOnly=true) |
add a new file entry. More... | |
void | MirrorFiles (const char *dirName, bool bOverwrite=false) |
copy all files to the given directory preserving relative path info. More... | |
void | UpdateMirrorFiles (const char *dirName, bool bOverwrite=true) |
this function is equivalent to calling the following functions. More... | |
void | AddExcludeFilter (const char *sPattern) |
exclude certain file extension, writable files, etc. More... | |
void | Reset () |
clear this instance for reuse. More... | |
bool | IsBegin () |
whether we are inside a log session. More... | |
bool | HasFile (const string &filename) |
whether there is already a file with the given file name in the current file entry | |
Static Public Member Functions | |
static CFileLogger * | GetInstance () |
get the singleton instance. More... | |
It is a singleton class that is tightly integrated to the game engine.
The default behavior of CFileLogger is this. Once activated, it first checks for ./InstallFiles.txt, and load it if it exists; then it checks for log file at temp/filelog.txt and load it if it exists. Then it hooks the CParaFile interface and record each read file operation. Once deactivated, it wrote the file log to temp/filelog.txt. Usually, at debug build, we will activate the File logger when application starts, and deactivate it when application exits. Basically file logger is an ideal way to check for read-only files, which can be zipped into a package at product release time.
void ParaEngine::CFileLogger::AddExcludeFilter | ( | const char * | sPattern | ) |
exclude certain file extension, writable files, etc.
sPattern |
void ParaEngine::CFileLogger::AddFile | ( | const char * | filename, |
bool | bReadOnly = true |
||
) |
add a new file entry.
filename | |
bReadOnly | whether this is a read-only file. |
bool ParaEngine::CFileLogger::BeginFileLog | ( | ) |
it will hook the CParaFile interface and record each read file operation.
void ParaEngine::CFileLogger::EndFileLog | ( | ) |
it will unhook the CParaFile interface and stop recording each read file operation.
|
static |
get the singleton instance.
bool ParaEngine::CFileLogger::IsBegin | ( | ) |
whether we are inside a log session.
bool ParaEngine::CFileLogger::LoadLogFromFile | ( | const char * | filename | ) |
Add new entries from file.
One can load multiple files, so that can append new identical files to previously recorded sessions
The logger file is just a list of file relative paths printed on each separate line.
– any comments goes here
filename
filename
filename
filename |
void ParaEngine::CFileLogger::MirrorFiles | ( | const char * | dirName, |
bool | bOverwrite = false |
||
) |
copy all files to the given directory preserving relative path info.
If file is not a disk file, zip file is searched.
dirName | such as "_InstallFiles/" |
bOverwrite | if this is true, existing files will be overridden. |
void ParaEngine::CFileLogger::Reset | ( | ) |
clear this instance for reuse.
It will remove all file entries.
void ParaEngine::CFileLogger::UpdateMirrorFiles | ( | const char * | dirName, |
bool | bOverwrite = true |
||
) |
this function is equivalent to calling the following functions.
LoadLogFromFile("InstallFiles.txt"); LoadLogFromFile("temp/filelog.txt"); MirrorFiles(dirName, bOverwrite);
dirName | such as "_InstallFiles/" |
bOverwrite | if this is true, existing files will be overridden. |