Commit b3847fde authored by Aleksandr Bakhshiev's avatar Aleksandr Bakhshiev
Browse files

Merge with default

--HG--
branch : MockCompsTest
......@@ -135,7 +135,13 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
programName=projectIniFile("General","ProgramName","Server");
configsMainPath=projectIniFile("General", "ConfigsMainPath", "../../../Configs/");
neverSleepOnMMThreadContention=atoi(projectIniFile("General","NeverSleepOnMMThreadContention","0"));
logDir=projectIniFile("Log","Dir","");
logDir=projectIniFile("Log","Dir",""); // TODO: Log/FixedLogPath
if(logDir.empty())
logDir=projectIniFile("Log","FixedLogPath",""); // TODO: Log/Dir
int logCreationMode=atoi(projectIniFile("Log","LogCreationMode","0"));
// bool SetFixedLogPath(const std::string& value);
startupDelay=atoi(projectIniFile("General","StartupDelay","0"));
useNewXmlFormatProjectFile=atoi(projectIniFile("General","UseNewXmlFormatProjectFile","0"));
......@@ -166,10 +172,18 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
application.SetApplicationFileName(application_file_name);
application.SetLogCreationMode(logCreationMode);
if(logDir.empty())
{
application.SetFixedLogPath(log_dir);
application.SetLogDir(log_dir);
}
else
{
application.SetFixedLogPath(logDir);
application.SetLogDir(logDir);
}
application.SetDebugMode(logDebugMode);
......@@ -178,7 +192,6 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
application.ChangeUseNewXmlFormatProjectFile(useNewXmlFormatProjectFile);
application.ChangeUseNewProjectFilesStructure(useNewProjectFilesStructure);
try
{
if(argc > 1)
......
......@@ -47,6 +47,7 @@ UApplication::UApplication(void)
ChangeUseNewXmlFormatProjectFile(false);
ChangeUseNewProjectFilesStructure(false);
StorageBuildMode = 1;
LogCreationMode=0;
//SetStandartXMLInCatalog();
......@@ -87,7 +88,8 @@ bool UApplication::SetWorkDirectory(const std::string& value)
if(WorkDirectory == value)
return true;
WorkDirectory=value;
UpdateLoggers();
if(FixedLogPath.empty())
UpdateLoggers();
return true;
}
......@@ -171,7 +173,8 @@ bool UApplication::SetProjectPath(const std::string& value)
if(ProjectPath == value)
return true;
ProjectPath=value;
UpdateLoggers();
if(LogCreationMode == 0 || LogCreationMode == 1)
UpdateLoggers();
// EngineControl->GetEngineStateThread()->CloseEventsLogFile();
CalcAppCaption();
return true;
......@@ -279,18 +282,53 @@ bool UApplication::SetDebugMode(bool value)
std::string UApplication::CalcCurrentLogDir(void) const
{
std::string log_dir;
if(Project && Project->GetConfig().OverrideLogParameters && !ProjectPath.empty())
switch(LogCreationMode)
{
case 0:
case 1:
{
log_dir=ProjectPath+"EventsLog/";
if(Project && Project->GetConfig().OverrideLogParameters && !ProjectPath.empty())
{
log_dir=ProjectPath+"EventsLog/";
}
else
{
if(FixedLogPath.empty())
{
log_dir=Core_GetLogDir();
if(log_dir.empty())
log_dir=WorkDirectory+"EventsLog/";
}
else
{
log_dir=FixedLogPath;
}
if(!log_dir.empty() && log_dir.find_last_of("\\/") != log_dir.size()-1)
log_dir+="/";
}
}
else
break;
case 2:
case 3:
{
log_dir=Core_GetLogDir();
if(log_dir.empty())
log_dir=WorkDirectory+"EventsLog/";
if(FixedLogPath.empty())
{
log_dir=Core_GetLogDir();
if(log_dir.empty())
log_dir=WorkDirectory+"EventsLog/";
}
else
{
log_dir=FixedLogPath;
}
if(!log_dir.empty() && log_dir.find_last_of("\\/") != log_dir.size()-1)
log_dir+="/";
}
break;
}
return log_dir;
}
......@@ -325,6 +363,43 @@ bool UApplication::IsInit(void) const
return AppIsInit;
}
///
const std::string& UApplication::GetFixedLogPath(void) const
{
return FixedLogPath;
}
bool UApplication::SetFixedLogPath(const std::string& value)
{
if(FixedLogPath == value)
return true;
FixedLogPath=value;
return true;
}
///
/// 0 - ( Reset )
/// 1 - .
/// 2 - .
/// 3 -
int UApplication::GetLogCreationMode(void) const
{
return LogCreationMode;
}
bool UApplication::SetLogCreationMode(int mode)
{
if(LogCreationMode == mode)
return true;
if(mode<0 || mode>3)
return false;
LogCreationMode=mode;
return true;
}
///
void UApplication::SetStorageBuildMode(int mode)
{
......@@ -1284,11 +1359,13 @@ bool UApplication::OpenProject(const std::string &filename)
ProjectFileName=extract_file_name(filename);
Project->SetProjectPath(ProjectPath);
Project->ReadFromXml(ProjectXml);
UpdateLoggers();
if(LogCreationMode != 3)
UpdateLoggers();
TProjectConfig config=Project->GetConfig();
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->SetEventsLogMode(config.EventsLogFlag);
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->Clear();
if(LogCreationMode != 3)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->Clear();
// EngineControl->GetEngineStateThread()->SetLogFlag(config.EventsLogFlag);
// EngineControl->GetEngineStateThread()->CloseEventsLogFile();
// EngineControl->GetEngineStateThread()->SetLogDir(ProjectPath);
......
......@@ -104,6 +104,17 @@ std::list<StandartXMLInCatalog> xmlInCatalog;
// 3 - . -, . ( )
int StorageBuildMode;
///
///
std::string FixedLogPath;
///
/// 0 - ( ResetChannel StartChannel )
/// 1 - .
/// 2 - .
/// 3 -
int LogCreationMode;
protected: //
///
UEPtr<URpcDispatcher> RpcDispatcher;
......@@ -203,6 +214,18 @@ bool ChangeUseNewProjectFilesStructure(bool value);
const std::list<StandartXMLInCatalog>& GetStandartXMLInCatalog(void) const;
bool SetStandartXMLInCatalog(void);
///
const std::string& GetFixedLogPath(void) const;
bool SetFixedLogPath(const std::string& value);
///
/// 0 - ( ResetChannel StartChannel )
/// 1 - .
/// 2 - .
/// 3 -
int GetLogCreationMode(void) const;
bool SetLogCreationMode(int mode);
///
const std::string& GetAppCaption(void) const;
......
......@@ -263,7 +263,8 @@ void UEngineControl::StartChannel(int channel_index)
if(channel_index>=GetNumChannels())
return;
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
if(Application && Application->GetLogCreationMode() == 0)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
// EngineStateThread->RecreateEventsLogFile();
switch(ThreadMode)
{
......@@ -367,7 +368,8 @@ void UEngineControl::PauseChannel(int channel_index)
break;
}
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->Clear();
if(Application && Application->GetLogCreationMode() == 0)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->Clear();
// EngineStateThread->CloseEventsLogFile();
}
......@@ -377,7 +379,8 @@ void UEngineControl::ResetChannel(int channel_index)
if(channel_index>=GetNumChannels())
return;
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
if(Application && Application->GetLogCreationMode() == 0)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
// EngineStateThread->RecreateEventsLogFile();
if(channel_index == -1)
{
......
......@@ -268,6 +268,17 @@ std::string extract_file_name(const std::string& full_name)
: full_name.substr(pos+1);
}
///
std::string extract_file_name_wo_ext(const std::string& full_name)
{
std::string file_name=extract_file_name(full_name);
size_t pos = file_name.find_last_of(".");
return (std::string::npos == pos)
? file_name
: file_name.substr(0,pos);
}
///
RDK_LIB_TYPE std::string extract_file_ext(const std::string& full_name)
{
......
......@@ -369,6 +369,9 @@ RDK_LIB_TYPE std::string extract_file_path(const std::string& full_name);
///
RDK_LIB_TYPE std::string extract_file_name(const std::string& full_name);
///
RDK_LIB_TYPE std::string extract_file_name_wo_ext(const std::string& full_name);
///
RDK_LIB_TYPE std::string extract_file_ext(const std::string& full_name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment