public function __construct($sMicrotime) { $this->iStartMicrotime = self::microtime($sMicrotime); $iEndTime = self::microtime(); self::$tTime[] = array('End', $iEndTime); $iDiff = $iEndTime - $this->iStartMicrotime; $this->add('Time', sprintf('%0.3f', $iDiff) . 's'); $this->addComplexTimes('times', self::$tTime); $this->addComplex('$_GET', print_r($_GET, 1)); if (isset($_POST)) { $this->addComplex('$_POST', print_r($_POST, 1)); } if (isset($_SESSION)) { $this->addComplex('$_SESSION', print_r($_SESSION, 1)); } if (isset($_SERVER)) { $this->addComplex('$_SERVER', print_r($_SERVER, 1)); } $oRequest = _root::getRequest(); $this->add('Module', $oRequest->getModule()); $this->add('Action', $oRequest->getAction()); $oFileLog = new _file(_root::getConfigVar('path.log', 'data/log/') . date('Y-m-d') . '_log.csv'); if ($oFileLog->exist()) { $oFileLog->load(); $sContentLog = $oFileLog->getContent(); $this->addFileLog('File log', $sContentLog); } $sVarIniConfig = _root::getConfigVar('model.ini.var', 'db'); $tClassSgbd = _root::getConfigVar($sVarIniConfig); $this->addComplexIni('Connexions', array($sVarIniConfig => $tClassSgbd)); $tConfigSection = array('path', 'cache', 'language', 'auth', 'acl', 'navigation', 'urlrewriting', 'security', 'log', 'check', 'path', 'model'); $tConfig = array(); foreach ($tConfigSection as $sSection) { $tConfig[$sSection] = _root::getConfigVar($sSection); } $this->addComplexIni('Config', $tConfig); if (self::$tSpy) { $this->addComplexSpy('Spy variables', self::$tSpy); } $this->addAcl(); }
private function writefile($sMessage) { $sMessage = preg_replace('/\\s+/', ' ', $sMessage); $oFileLog = new _file(_root::getConfigVar('path.log', 'data/log/') . date('Y-m-d') . '_log.csv'); if ($oFileLog->exist()) { $oFileLog->load(); } $oFileLog->addContent(date('Y-m-d') . ';' . date('H:i:s') . ';' . $sMessage . "\n"); try { $oFileLog->save(); } catch (Exception $e) { throw new Exception('Probleme lors de l\'ecriture du log' . "\n" . 'note:verifier les droits du repertoire ' . _root::getConfigVar('path.log', 'data/log') . "\n" . 'Exception: ' . $e->getMessage()); } $oFileLog->clean(); }