当前位置: 首页>>代码示例>>PHP>>正文


PHP sfLogger::getPriorityName方法代码示例

本文整理汇总了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;
 }
开发者ID:havvg,项目名称:sfMongoDBLoggerPlugin,代码行数:15,代码来源:sfMongoDBLoggerListener.class.php

示例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);
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:11,代码来源:sfFileLogger.class.php

示例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);
开发者ID:hunde,项目名称:bsc,代码行数:31,代码来源:sfLoggerTest.php


注:本文中的sfLogger::getPriorityName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。