debugEnabled = $this->isDebugOn(); } public function isDebugOn() { $isDebug = false; $cfgModule = $this->Application->getModule('configuration'); if($cfgModule->isApplicationConfig() === true) { $config = $cfgModule->getApplicationConfig(); $isDebug = (isset($config['baculum']['debug']) && intval($config['baculum']['debug']) === 1); } else { $isDebug = true; } return $isDebug; } public function enableDebug($enable) { $result = false; $cfgModule = $this->Application->getModule('configuration'); if($cfgModule->isApplicationConfig() === true) { $config = $cfgModule->getApplicationConfig(); $config['baculum']['debug'] = ($enable === true) ? "1" : "0"; $result = $cfgModule->setApplicationConfig($config); } return $result; } private function getLogCategories() { $categories = array( self::CATEGORY_EXECUTE, self::CATEGORY_EXTERNAL, self::CATEGORY_APPLICATION, self::CATEGORY_GENERAL, self::CATEGORY_SECURITY ); return $categories; } public function log($cmd, $output, $category, $file, $line) { if($this->debugEnabled !== true) { return; } $this->Application->setMode('Debug'); if(!in_array($category, $this->getLogCategories())) { $category = self::CATEGORY_SECURITY; } $log = sprintf( 'Command=%s, Output=%s, File=%s, Line=%d', $cmd, print_r($output, true), $file, intval($line) ); Prado::trace($log, $category); } } ?>