本文整理匯總了PHP中Icinga\Application\Logger::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Logger::create方法的具體用法?PHP Logger::create怎麽用?PHP Logger::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Icinga\Application\Logger
的用法示例。
在下文中一共展示了Logger::create方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setupLogger
/**
* {@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;
}
示例2: setupLogger
/**
* 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;
}
示例3: setupLogging
protected function setupLogging()
{
Logger::create(new ConfigObject(array('level' => Logger::INFO, 'log' => 'stdout')));
return $this;
}