m_strDirRoot=strLogBaseDir."\\ServerLog\\".\CommFunc\GetMonth()."\\"; } else { $this->m_strDirRoot=$strRootDir; } #¹¹ÔìÈÕÖ¾¶ÔÏóºÍÊý×é $this->m_arrayLog=array(); $this->AddLogObj( $strFileDir, $strFileName, $strExtraInfo ); } #Ôö¼Ólog¶ÔÏó public function AddLogObj( $strFileDir, $strFileName, $strExtraInfo='' ) { #»ñµÃÈÎÒâÒ»¸öÈÕÖ¾¶ÔÏó£¬È¡µÃËüµÄÀ©Õ¹Êä³öÄÚÈÝ if( count($this->m_arrayLog) ) { foreach ( $this->m_arrayLog as $log ) { $strExtraInfo=$log->GetAffixStr()." ".$strExtraInfo; break; } } foreach( $this->m_arrayLog as $log ) { $log->SetAffixStr( $strExtraInfo ); } if( bNewStyleLogging ) { $strPhpDir=$this->m_strDirRoot.self::strLogDir."\\".date("d",time()).'\\'.$strFileDir; } else { $strPhpDir=$this->m_strDirRoot.self::strLogDir.'\\'.$strFileDir; } $logPhpFile=new \Log4Me\Log4Me( $strPhpDir, $strFileName ); $logPhpFile->SetAffixStr( $strExtraInfo ); $this->m_arrayLog[$strFileName]=$logPhpFile; } #ÒÆ³ýlog¶ÔÏó£¬Èç¹û´æÔڵϰ private function RemoveLogObj( $logName ) { $logObj=GetLogObj($logName); unset( $logObj ); } #¸ù¾ÝlogÃû£¬»ñµÃLog¶ÔÏó public function &GetLogObj( $logName ) { if( !array_key_exists( $logName, $this->m_arrayLog ) ) { return null; } return $this->m_arrayLog[$logName]; } public function Debug( $info ) { foreach( $this->m_arrayLog as $log ) { $log->Debug( $info ); } } public function Info( $info ) { foreach( $this->m_arrayLog as $log ) { $log->Info( $info ); } } public function Warn( $info ) { foreach( $this->m_arrayLog as $log ) { $log->Warn( $info ); } } public function Error( $info ) { foreach( $this->m_arrayLog as $log ) { $log->Error( $info ); } } public function Fatal( $info ) { foreach( $this->m_arrayLog as $log ) { $log->Fatal( $info ); } } } ?>