Index: src/ch/AsyncHttpFile.cpp =================================================================== diff -u -r12b36349f6214befeace08efa9acc7e03be0d847 -ra08ca9e12d93e9a036a5cf739348ff3ef2a58be8 --- src/ch/AsyncHttpFile.cpp (.../AsyncHttpFile.cpp) (revision 12b36349f6214befeace08efa9acc7e03be0d847) +++ src/ch/AsyncHttpFile.cpp (.../AsyncHttpFile.cpp) (revision a08ca9e12d93e9a036a5cf739348ff3ef2a58be8) @@ -355,7 +355,7 @@ logger::TLoggerPtr spLog = logger::MakeLogger(GetLogFileData(), L"AsyncHttpFile"); CString strMsg; - strMsg.Format(_T("[CAsyncHttpFile::InternetStatusCallback] hInternet: %p, dwContext: %Iu (operation: %lu), dwInternetStatus: %lu, lpvStatusInformation: %p, dwStatusInformationLength: %lu\n"), + strMsg.Format(_T("[InternetStatusCallback] hInternet: %p, dwContext: %Iu (operation: %lu), dwInternetStatus: %lu, lpvStatusInformation: %p, dwStatusInformationLength: %lu"), hInternet, (size_t)dwContext, pRequest->eOperationType, dwInternetStatus, lpvStatusInformation, dwStatusInformationLength); ATLTRACE(L"%s\n", strMsg); LOG_DEBUG(spLog) << strMsg; Index: src/ch/CfgProperties.h =================================================================== diff -u -rffbc773697bd08220163bf1e4491a34376b0f61c -ra08ca9e12d93e9a036a5cf739348ff3ef2a58be8 --- src/ch/CfgProperties.h (.../CfgProperties.h) (revision ffbc773697bd08220163bf1e4491a34376b0f61c) +++ src/ch/CfgProperties.h (.../CfgProperties.h) (revision a08ca9e12d93e9a036a5cf739348ff3ef2a58be8) @@ -215,8 +215,8 @@ PROPERTY(PP_SHORTCUTS, CStringVector, _T("CHConfig.General.Program.Shortcuts.Shortcut"), (CStringVector())); PROPERTY(PP_RECENTPATHS, CStringVector, _T("CHConfig.General.Program.RecentPaths.Path"), (CStringVector())); -PROPERTY_MINMAX(PP_LOGMAXSIZE, int, _T("CHConfig.General.Logging.SizeLimit"), 1024 * 1024, 1024, 0xffffffff); -PROPERTY_MINMAX(PP_LOGROTATECOUNT, int, _T("CHConfig.General.Logging.RotateCount"), 5, 1, 0xffffffff); +PROPERTY_MINMAX(PP_LOGMAXSIZE, unsigned int, _T("CHConfig.General.Logging.SizeLimit"), 1024 * 1024, 1024, 0xffffffff); +PROPERTY_MINMAX(PP_LOGROTATECOUNT, unsigned int, _T("CHConfig.General.Logging.RotateCount"), 5, 1, 0xffffffff); PROPERTY_MINMAX(PP_LOGLEVEL_APP, int, _T("CHConfig.General.Logging.Level.App"), boost::log::trivial::warning, boost::log::trivial::trace, boost::log::trivial::fatal); PROPERTY_MINMAX(PP_LOGLEVEL_ENGINEDEFAULT, int, _T("CHConfig.General.Logging.Level.EngineDefault"), boost::log::trivial::warning, boost::log::trivial::trace, boost::log::trivial::fatal); PROPERTY_MINMAX(PP_LOGLEVEL_SERIALIZER, int, _T("CHConfig.General.Logging.Level.Serializer"), boost::log::trivial::warning, boost::log::trivial::trace, boost::log::trivial::fatal); Index: src/ch/MainWnd.cpp =================================================================== diff -u -r12b36349f6214befeace08efa9acc7e03be0d847 -ra08ca9e12d93e9a036a5cf739348ff3ef2a58be8 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 12b36349f6214befeace08efa9acc7e03be0d847) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision a08ca9e12d93e9a036a5cf739348ff3ef2a58be8) @@ -245,20 +245,9 @@ TSQLiteSerializerFactoryPtr spSerializerFactory(new TSQLiteSerializerFactory(PathFromString(strTasksDir))); IFeedbackHandlerFactoryPtr spFeedbackFactory(new CFeedbackHandlerFactory); - chcore::TConfig& rConfig = GetConfig(); - logger::TMultiLoggerConfigPtr spLoggerConfig = std::make_shared(); - spLoggerConfig->SetLogLevel(L"default", (logger::ESeverityLevel)GetPropValue(rConfig)); - spLoggerConfig->SetLogLevel(L"Filesystem", (logger::ESeverityLevel)GetPropValue(rConfig)); - spLoggerConfig->SetLogLevel(L"Filesystem-File", (logger::ESeverityLevel)GetPropValue(rConfig)); - spLoggerConfig->SetLogLevel(L"Task", (logger::ESeverityLevel)GetPropValue(rConfig)); - spLoggerConfig->SetLogLevel(L"ST-FastMove", (logger::ESeverityLevel)GetPropValue(rConfig)); - spLoggerConfig->SetLogLevel(L"ST-CopyMove", (logger::ESeverityLevel)GetPropValue(rConfig)); - spLoggerConfig->SetLogLevel(L"ST-Delete", (logger::ESeverityLevel)GetPropValue(rConfig)); - spLoggerConfig->SetLogLevel(L"ST-ScanDirs", (logger::ESeverityLevel)GetPropValue(rConfig)); - try { - m_spTasks.reset(new chcore::TTaskManager(spSerializerFactory, spFeedbackFactory, PathFromString(strTasksDir), spLoggerConfig)); + m_spTasks.reset(new chcore::TTaskManager(spSerializerFactory, spFeedbackFactory, PathFromString(strTasksDir), GetApp().GetEngineLoggerConfig())); } catch(const std::exception& e) { @@ -269,7 +258,7 @@ { if(MsgBox(IDS_TASKMANAGER_LOAD_FAILED, MB_ICONERROR | MB_OKCANCEL) == IDOK) { - m_spTasks.reset(new chcore::TTaskManager(spSerializerFactory, spFeedbackFactory, PathFromString(strTasksDir), spLoggerConfig, true)); + m_spTasks.reset(new chcore::TTaskManager(spSerializerFactory, spFeedbackFactory, PathFromString(strTasksDir), GetApp().GetEngineLoggerConfig(), true)); } else return false; Index: src/ch/ch.cpp =================================================================== diff -u -r12b36349f6214befeace08efa9acc7e03be0d847 -ra08ca9e12d93e9a036a5cf739348ff3ef2a58be8 --- src/ch/ch.cpp (.../ch.cpp) (revision 12b36349f6214befeace08efa9acc7e03be0d847) +++ src/ch/ch.cpp (.../ch.cpp) (revision a08ca9e12d93e9a036a5cf739348ff3ef2a58be8) @@ -99,7 +99,9 @@ } CCopyHandlerApp::CCopyHandlerApp() : - m_pMainWindow(nullptr) + m_pMainWindow(nullptr), + m_spAppLoggerConfig(std::make_shared()), + m_spEngineLoggerConfig(std::make_shared()) { // this is the one-instance application InitProtection(); @@ -311,13 +313,20 @@ InitLoggers(); // logger config - logger::TMultiLoggerConfigPtr spAppLoggerConfig = std::make_shared(); - spAppLoggerConfig->SetLogLevel(L"default", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spAppLoggerConfig->SetLogLevel(L"default", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"default", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Filesystem", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Filesystem-File", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Task", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"ST-FastMove", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"ST-CopyMove", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"ST-Delete", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"ST-ScanDirs", (logger::ESeverityLevel)GetPropValue(rCfg)); // initialize the global log file if it is requested by configuration file CString strLogPath = strPath + _T("\\ch.log"); - m_spLog = logger::MakeLogger(logger::TAsyncMultiLogger::GetInstance()->CreateLoggerData(strLogPath, spAppLoggerConfig), L"App"); + m_spLog = logger::MakeLogger(logger::TAsyncMultiLogger::GetInstance()->CreateLoggerData(strLogPath, m_spAppLoggerConfig), L"App"); LOG_INFO(m_spLog) << _T("============================ Initializing Copy Handler ============================"); LOG_INFO(m_spLog) << _T(""); @@ -500,10 +509,8 @@ { chcore::TConfig& rConfig = GetConfig(); - int iMaxSize = GetPropValue(rConfig); - int iRotateCount = GetPropValue(rConfig); - - logger::TAsyncMultiLogger::GetInstance()->SetRotationInfo(iMaxSize, iRotateCount); + logger::TAsyncMultiLogger::GetInstance()->SetMaxLogSize(GetPropValue(rConfig)); + logger::TAsyncMultiLogger::GetInstance()->SetMaxRotatedCount(GetPropValue(rConfig)); } void CCopyHandlerApp::InitShellExtension() @@ -588,6 +595,11 @@ return m_spLog->GetLogFileData(); } +logger::TMultiLoggerConfigPtr CCopyHandlerApp::GetEngineLoggerConfig() const +{ + return m_spEngineLoggerConfig; +} + void CCopyHandlerApp::RegisterShellExtension() { CString strPath = CString(m_pathProcessor.GetProgramPath()) + _T("\\"); @@ -657,6 +669,8 @@ void CCopyHandlerApp::OnConfigNotify(const chcore::TStringSet& setPropNames) { + chcore::TConfig& rCfg = GetConfig(); + // is this language if(setPropNames.HasValue(PropData::GetPropertyName())) { @@ -665,28 +679,31 @@ GetPropValue(GetConfig(), strPath); GetResManager().SetLanguage(m_pathProcessor.ExpandPath(strPath)); } -/* - if(setPropNames.HasValue(PropData::GetPropertyName())) - { - chcore::TLogger& rLogger = chcore::TLogger::Acquire(); - - rLogger.Enable(GetPropValue(GetConfig())); - } - - if(setPropNames.HasValue(PropData::GetPropertyName())) - { - chcore::TLogger& rLogger = chcore::TLogger::Acquire(); - - rLogger.set_log_level(GetPropValue(GetConfig())); - } - if(setPropNames.HasValue(PropData::GetPropertyName())) - { - chcore::TLogger& rLogger = chcore::TLogger::Acquire(); + logger::TAsyncMultiLogger::GetInstance()->SetMaxLogSize(GetPropValue(GetConfig())); + if(setPropNames.HasValue(PropData::GetPropertyName())) + logger::TAsyncMultiLogger::GetInstance()->SetMaxRotatedCount(GetPropValue(GetConfig())); - rLogger.set_max_size(GetPropValue(GetConfig())); - }*/ + if(setPropNames.HasValue(PropData::GetPropertyName())) + m_spLog->GetLogFileData()->GetMultiLoggerConfig()->SetLogLevel(L"default", (logger::ESeverityLevel)GetPropValue(rCfg)); + + if(setPropNames.HasValue(PropData::GetPropertyName())) + m_spEngineLoggerConfig->SetLogLevel(L"default", (logger::ESeverityLevel)GetPropValue(rCfg)); + if(setPropNames.HasValue(PropData::GetPropertyName())) + m_spEngineLoggerConfig->SetLogLevel(L"Filesystem", (logger::ESeverityLevel)GetPropValue(rCfg)); + if(setPropNames.HasValue(PropData::GetPropertyName())) + m_spEngineLoggerConfig->SetLogLevel(L"Filesystem-File", (logger::ESeverityLevel)GetPropValue(rCfg)); + if(setPropNames.HasValue(PropData::GetPropertyName())) + m_spEngineLoggerConfig->SetLogLevel(L"Task", (logger::ESeverityLevel)GetPropValue(rCfg)); + if(setPropNames.HasValue(PropData::GetPropertyName())) + m_spEngineLoggerConfig->SetLogLevel(L"ST-FastMove", (logger::ESeverityLevel)GetPropValue(rCfg)); + if(setPropNames.HasValue(PropData::GetPropertyName())) + m_spEngineLoggerConfig->SetLogLevel(L"ST-CopyMove", (logger::ESeverityLevel)GetPropValue(rCfg)); + if(setPropNames.HasValue(PropData::GetPropertyName())) + m_spEngineLoggerConfig->SetLogLevel(L"ST-Delete", (logger::ESeverityLevel)GetPropValue(rCfg)); + if(setPropNames.HasValue(PropData::GetPropertyName())) + m_spEngineLoggerConfig->SetLogLevel(L"ST-ScanDirs", (logger::ESeverityLevel)GetPropValue(rCfg)); } void CCopyHandlerApp::OnResManNotify(UINT uiType) Index: src/ch/ch.h =================================================================== diff -u -r12b36349f6214befeace08efa9acc7e03be0d847 -ra08ca9e12d93e9a036a5cf739348ff3ef2a58be8 --- src/ch/ch.h (.../ch.h) (revision 12b36349f6214befeace08efa9acc7e03be0d847) +++ src/ch/ch.h (.../ch.h) (revision a08ca9e12d93e9a036a5cf739348ff3ef2a58be8) @@ -47,6 +47,7 @@ static chcore::TConfig& GetConfig(); logger::TLogFileDataPtr GetLogFileData() const; + logger::TMultiLoggerConfigPtr GetEngineLoggerConfig() const; void RegisterShellExtension(); void UnregisterShellExtension(); @@ -70,6 +71,9 @@ chcore::TCoreEngine m_chEngine; logger::TLoggerPtr m_spLog; + logger::TMultiLoggerConfigPtr m_spAppLoggerConfig; + logger::TMultiLoggerConfigPtr m_spEngineLoggerConfig; + CWnd *m_pMainWindow; DECLARE_MESSAGE_MAP() Index: src/liblogger/TAsyncMultiLogger.cpp =================================================================== diff -u -r800b6e4dd2e62623eab76ac2d16d63af2a67a045 -ra08ca9e12d93e9a036a5cf739348ff3ef2a58be8 --- src/liblogger/TAsyncMultiLogger.cpp (.../TAsyncMultiLogger.cpp) (revision 800b6e4dd2e62623eab76ac2d16d63af2a67a045) +++ src/liblogger/TAsyncMultiLogger.cpp (.../TAsyncMultiLogger.cpp) (revision a08ca9e12d93e9a036a5cf739348ff3ef2a58be8) @@ -78,9 +78,13 @@ return m_spGlobalRotationInfo; } - void TAsyncMultiLogger::SetRotationInfo(unsigned int uiMaxLogSize, unsigned int uiMaxRotatedCount) + void TAsyncMultiLogger::SetMaxLogSize(unsigned int uiMaxLogSize) { m_spGlobalRotationInfo->SetMaxLogSize(uiMaxLogSize); + } + + void TAsyncMultiLogger::SetMaxRotatedCount(unsigned int uiMaxRotatedCount) + { m_spGlobalRotationInfo->SetRotatedCount(uiMaxRotatedCount); } Index: src/liblogger/TAsyncMultiLogger.h =================================================================== diff -u -r7de00e54431d78b6c54fad6fb163dbc306381ef5 -ra08ca9e12d93e9a036a5cf739348ff3ef2a58be8 --- src/liblogger/TAsyncMultiLogger.h (.../TAsyncMultiLogger.h) (revision 7de00e54431d78b6c54fad6fb163dbc306381ef5) +++ src/liblogger/TAsyncMultiLogger.h (.../TAsyncMultiLogger.h) (revision a08ca9e12d93e9a036a5cf739348ff3ef2a58be8) @@ -43,7 +43,8 @@ TLogFileDataPtr CreateLoggerData(PCTSTR pszLogPath, const TMultiLoggerConfigPtr& spLoggerConfig); TLoggerRotationInfoPtr GetRotationInfo() const; - void SetRotationInfo(unsigned int uiMaxLogSize, unsigned int uiMaxRotatedCount); + void SetMaxLogSize(unsigned int uiMaxLogSize); + void SetMaxRotatedCount(unsigned int uiMaxRotatedCount); private: void LoggingThread();