/** * Constructor. * * It reads the config file and setup the logging system */ public function Logger(IConfigurator $configurator) { $outputters = $configurator->getLoggerOutputters(); if (sizeof($outputters) != 0) { $this->load($outputters); } $this->setLevel(Logger::DEBUG); // TODO: check this line again please. if ($_klazz = $configurator->getLoggerFormatter()) { include_once 'logger' . DIRECTORY_SEPARATOR . 'formatter' . DIRECTORY_SEPARATOR . $_klazz . '.php'; $this->formatter = new $_klazz(); } }
public static function outputters(IConfigurator $config) { $instances = array(); foreach ($config->logger_outputters() as $outputter) { $class = ucfirst((string) trim($outputter['name'])) . 'Outputter'; $klass = new $class($outputter['level']); foreach ($outputter->property as $property) { $klass->setProperty((string) trim($property['name']), (string) trim($property['value'])); } $klass->initialize(); $instances[] = $klass; } return $instances; }
/** * Injects a user helper. * * @param string location, base location of this helper. * @throws FileNotFoundException if the helper cannot be loaded. * @return void * @access private */ protected function injectHelper($name) { $helper_file = $this->path['helpers'] . $name . '_helper.php'; $this->logger->debug('[Medick] >> Loading Helper `' . $name . '` from ' . str_replace($this->config->getApplicationPath(), '${' . $this->config->getApplicationName() . '}', $helper_file)); try { return $this->includeFile($helper_file, $name . '_helper.php'); } catch (FileNotFoundException $fnfEx) { $this->logger->info(sprintf('[Medick] >> Skipped missing helper %s', $name)); } }
/** * Injects a user helper. * * @param string location, base location of this helper. * @throws FileNotFoundException if the helper cannot be loaded. * @return void * @access private */ protected function injectHelper($name) { $helper_file = $this->path['helpers'] . $name . '_helper.php'; $this->logger->debug('[Medick] >> Lading Helper ' . $name . ' from ' . str_replace($this->config->getApplicationPath(), '${' . $this->config->getApplicationName() . '}', $helper_file)); return $this->includeFile($helper_file, $name . '_helper.php'); }
public static function setConnectionDsn(IConfigurator $config) { self::$__connection_dsn = $config->getDatabaseDsn(self::$__connection_dsn_id); ksort(self::$__connection_dsn); self::$__connection_key = crc32(serialize(self::$__connection_dsn)); }