Logger* Logger::GetSubLogger(std::string aSubName, int aFilterBits) { std::ostringstream oss; oss << mName << "." << aSubName; Logger* pLogger = mpLog->GetLogger(LEV_WARNING, oss.str()); pLogger->SetVarName(mVarName); pLogger->mLevel = aFilterBits; return pLogger; }
IDataObserver* AsyncStackManager::AddSlave( const std::string& arPortName, const std::string& arStackName, FilterLevel aLevel, ICommandAcceptor* apCmdAcceptor, const SlaveStackConfig& arCfg) { Port* pPort = this->AllocatePort(arPortName); Logger* pLogger = mpLogger->GetSubLogger(arStackName, aLevel); pLogger->SetVarName(arStackName); SlaveStack* pSlave = new SlaveStack(pLogger, &mTimerSrc, apCmdAcceptor, arCfg); this->OnAddStack(arStackName, pSlave, pPort, arCfg.link.LocalAddr); return pSlave->mSlave.GetDataObserver(); }
ICommandAcceptor* AsyncStackManager::AddMaster( const std::string& arPortName, const std::string& arStackName, FilterLevel aLevel, IDataObserver* apPublisher, const MasterStackConfig& arCfg) { Port* pPort = this->AllocatePort(arPortName); Logger* pLogger = mpLogger->GetSubLogger(arStackName, aLevel); pLogger->SetVarName(arStackName); MasterStack* pMaster = new MasterStack(pLogger, &mTimerSrc, apPublisher, pPort->GetGroup(), arCfg); this->OnAddStack(arStackName, pMaster, pPort, arCfg.link.LocalAddr); return pMaster->mMaster.GetCmdAcceptor(); }