本文整理汇总了PHP中sfLogger::getPriorityName方法的典型用法代码示例。如果您正苦于以下问题:PHP sfLogger::getPriorityName方法的具体用法?PHP sfLogger::getPriorityName怎么用?PHP sfLogger::getPriorityName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfLogger
的用法示例。
在下文中一共展示了sfLogger::getPriorityName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convertLogPriority
/**
* Converts the log priority into its string representation.
*
* @param sfEvent $event
* @param array $logEntry
*
* @return array
*/
public static function convertLogPriority(sfEvent $event, array $logEntry)
{
if (is_int($logEntry['priority'])) {
$logEntry['priority'] = sfLogger::getPriorityName($logEntry['priority']);
}
return $logEntry;
}
示例2: getPriority
/**
* Returns the priority string to use in log messages.
*
* @param string $priority The priority constant
*
* @return string The priority to use in log messages
*/
protected function getPriority($priority)
{
return sfLogger::getPriorityName($priority);
}
示例3: array
// ->setLogLevel() ->getLogLevel()
$t->diag('->setLogLevel() ->getLogLevel()');
$t->is($logger->getLogLevel(), sfLogger::INFO, '->getLogLevel() gets the current log level');
$logger->setLogLevel(sfLogger::WARNING);
$t->is($logger->getLogLevel(), sfLogger::WARNING, '->setLogLevel() sets the log level');
$logger->setLogLevel('err');
$t->is($logger->getLogLevel(), sfLogger::ERR, '->setLogLevel() accepts a class constant or a string as its argument');
// ->initialize()
$t->diag('->initialize()');
$logger->initialize($dispatcher, array('level' => sfLogger::ERR));
$t->is($logger->getLogLevel(), sfLogger::ERR, '->initialize() takes an array of options as its second argument');
// ::getPriorityName()
$t->diag('::getPriorityName()');
$t->is(sfLogger::getPriorityName(sfLogger::INFO), 'info', '::getPriorityName() returns the name of a priority class constant');
try {
sfLogger::getPriorityName(100);
$t->fail('::getPriorityName() throws an sfException if the priority constant does not exist');
} catch (sfException $e) {
$t->pass('::getPriorityName() throws an sfException if the priority constant does not exist');
}
// ->log()
$t->diag('->log()');
$logger->setLogLevel(sfLogger::DEBUG);
$logger->log('message');
$t->is($logger->log, 'message', '->log() logs a message');
// log level
$t->diag('log levels');
foreach (array('emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', 'debug') as $level) {
$levelConstant = 'sfLogger::' . strtoupper($level);
foreach (array('emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', 'debug') as $logLevel) {
$logLevelConstant = 'sfLogger::' . strtoupper($logLevel);