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

Log control has been updated

parent 69c5e4d490f4
......@@ -105,7 +105,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"));
......@@ -121,10 +127,18 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
disableAdminForm=atoi(projectIniFile("General","DisableAdminForm","0"));
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);
......@@ -132,7 +146,6 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
application.ChangeUseNewXmlFormatProjectFile(useNewXmlFormatProjectFile);
application.ChangeUseNewProjectFilesStructure(useNewProjectFilesStructure);
if(argc > 1)
application.ProcessCommandLineArgs(argc, argv);
......
......@@ -46,6 +46,7 @@ UApplication::UApplication(void)
ModelsMainPath="../../../Models/";
ChangeUseNewXmlFormatProjectFile(false);
ChangeUseNewProjectFilesStructure(false);
LogCreationMode=0;
//SetStandartXMLInCatalog();
......@@ -86,6 +87,7 @@ bool UApplication::SetWorkDirectory(const std::string& value)
if(WorkDirectory == value)
return true;
WorkDirectory=value;
if(FixedLogPath.empty())
UpdateLoggers();
return true;
}
......@@ -156,6 +158,7 @@ bool UApplication::SetProjectPath(const std::string& value)
if(ProjectPath == value)
return true;
ProjectPath=value;
if(LogCreationMode == 0 || LogCreationMode == 1)
UpdateLoggers();
// EngineControl->GetEngineStateThread()->CloseEventsLogFile();
CalcAppCaption();
......@@ -264,18 +267,53 @@ bool UApplication::SetDebugMode(bool value)
std::string UApplication::CalcCurrentLogDir(void) const
{
std::string log_dir;
switch(LogCreationMode)
{
case 0:
case 1:
{
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+="/";
}
}
break;
case 2:
case 3:
{
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;
}
......@@ -309,6 +347,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;
}
// --------------------------
// --------------------------
......@@ -1217,6 +1292,7 @@ bool UApplication::OpenProject(const std::string &filename)
ProjectFileName=extract_file_name(filename);
Project->SetProjectPath(ProjectPath);
Project->ReadFromXml(ProjectXml);
if(LogCreationMode != 3)
UpdateLoggers();
TProjectConfig config=Project->GetConfig();
......
......@@ -94,6 +94,17 @@ bool AppIsInit;
/// xml ( /Bin/Models)
std::list<StandartXMLInCatalog> xmlInCatalog;
///
///
std::string FixedLogPath;
///
/// 0 - ( ResetChannel StartChannel )
/// 1 - .
/// 2 - .
/// 3 -
int LogCreationMode;
protected: //
///
UEPtr<URpcDispatcher> RpcDispatcher;
......@@ -186,6 +197,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,6 +263,7 @@ void UEngineControl::StartChannel(int channel_index)
if(channel_index>=GetNumChannels())
return;
if(Application && Application->GetLogCreationMode() == 0)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
// EngineStateThread->RecreateEventsLogFile();
switch(ThreadMode)
......@@ -377,6 +378,7 @@ void UEngineControl::ResetChannel(int channel_index)
if(channel_index>=GetNumChannels())
return;
if(Application && Application->GetLogCreationMode() == 0)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
// EngineStateThread->RecreateEventsLogFile();
if(channel_index == -1)
......
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