/** * {@inheritdoc} */ protected function setupLogger() { $config = new ConfigObject(); $config->log = $this->params->shift('log', 'stderr'); if ($config->log === 'file') { $config->file = $this->params->shiftRequired('log-path'); } elseif ($config->log === 'syslog') { $config->application = 'icingacli'; } if ($this->params->get('verbose', false)) { $config->level = Logger::INFO; } elseif ($this->params->get('debug', false)) { $config->level = Logger::DEBUG; } else { $config->level = Logger::WARNING; } Logger::create($config); return $this; }
/** * Set up logger * * @return $this */ protected function setupLogger() { if ($this->config->hasSection('logging')) { $loggingConfig = $this->config->getSection('logging'); try { Logger::create($loggingConfig); } catch (ConfigurationError $e) { Logger::getInstance()->registerConfigError($e->getMessage()); try { Logger::getInstance()->setLevel($loggingConfig->get('level', Logger::ERROR)); } catch (ConfigurationError $e) { Logger::getInstance()->registerConfigError($e->getMessage()); } } } return $this; }
protected function setupLogging() { Logger::create(new ConfigObject(array('level' => Logger::INFO, 'log' => 'stdout'))); return $this; }