add: command line param -multi-log-files.

This commit is contained in:
dancingfish
2017-01-04 15:44:42 +08:00
parent f9f4a4a947
commit ce617ac9f8
2 changed files with 14 additions and 4 deletions

View File

@@ -25,6 +25,7 @@ ProjectConfig::ProjectConfig()
, _showConsole(true)
, _loadPrecompiledFramework(false)
, _writeDebugLogToFile(true)
, _isMultiLogFiles(false)
, _windowOffset(0, 0)
, _debuggerType(kCCLuaDebuggerNone)
, _isAppMenu(true)
@@ -270,11 +271,14 @@ void ProjectConfig::setWriteDebugLogToFile(bool writeDebugLogToFile)
string ProjectConfig::getDebugLogFilePath() const
{
auto path(getProjectDir());
time_t t = time(0);
char tmp[64];
strftime(tmp, sizeof(tmp), "_%Y%m%d_%H%M%S", localtime(&t));
path.append("debug");
path.append(tmp);
if (_isMultiLogFiles)
{
time_t t = time(0);
char tmp[64] = {};
strftime(tmp, sizeof(tmp), "_%Y%m%d_%H%M%S", localtime(&t));
path.append(tmp);
}
path.append(".log");
return path;
}
@@ -378,6 +382,10 @@ void ProjectConfig::parseCommandLine(const vector<string> &args)
{
setWriteDebugLogToFile(false);
}
else if (arg.compare("-multi-log-files") == 0)
{
_isMultiLogFiles = true;
}
else if (arg.compare("-console") == 0)
{
setShowConsole(true);
@@ -587,6 +595,7 @@ void ProjectConfig::dump()
CCLOG(" frame scale: %0.2f", _frameScale);
CCLOG(" show console: %s", _showConsole ? "YES" : "NO");
CCLOG(" write debug log: %s", _writeDebugLogToFile ? "YES" : "NO");
CCLOG(" create multi log files: %s", _isMultiLogFiles ? "YES" : "NO");
CCLOG(" debugger: none");
CCLOG("\n\n");
}