Ejemplo n.º 1
0
 protected function parseConfig(Config $config)
 {
     parent::parseConfig($config);
     $this->parseConfigOption($config, 'output');
     $this->parseConfigOption($config, 'mode', false);
     $this->validateOutput();
 }
Ejemplo n.º 2
0
 protected function resolveLoggerConfig()
 {
     $candidate = null;
     foreach ($this->config->loggers as $nodeName => $config) {
         if ($candidate === null && $nodeName === self::ROOT_LOGGER || self::isMoreSpecific($candidate, $nodeName, $this->loggerName)) {
             $candidate = $nodeName;
         }
     }
     //store the config logger name
     $this->actualLoggerName = $candidate;
     $loggerConfig = $this->config->loggers->{$candidate};
     //set the bubbling configuration
     if (!is_null($loggerConfig->bubbleUp)) {
         $this->bubbleUp = $loggerConfig->bubbleUp;
     }
     $writers = $loggerConfig->writers;
     if ($writers) {
         foreach ($writers as $writer) {
             if ($writer->writer === null) {
                 throw new LoggerException(sprintf("Incorrect logger definition."));
             }
             $writerConfig = $this->config->writers->{$writer->writer};
             if ($writerConfig === null) {
                 throw new LoggerException(sprintf("Could not locate a writer definition named: %s", $writer->writer));
             }
             $this->filters[$writer->writer] = new Filter($this, Level::fromString($writer->level), Writer::runFactory($writer->writer, $writerConfig));
         }
     } else {
         throw new LoggerException(sprintf("No writers defined for logger: %s", $this->loggerName));
     }
 }
Ejemplo n.º 3
0
 protected function parseConfig(Config $config)
 {
     parent::parseConfig($config);
     $this->parseConfigOption($config, 'connector');
     $this->parseConfigOption($config, 'table');
     if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $this->table)) {
         throw new LoggerException(sprintf("Invalid table name for DbWriter: %s", $this->table));
     }
     $this->activeConnector = Nutshell::getInstance()->plugin->Db->{$this->connector};
 }