本文整理汇总了PHP中CakeLog::_levelMap方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeLog::_levelMap方法的具体用法?PHP CakeLog::_levelMap怎么用?PHP CakeLog::_levelMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CakeLog
的用法示例。
在下文中一共展示了CakeLog::_levelMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defaultLevels
/**
* Reset log levels to the original value
*
* @return array Default log levels
*/
public static function defaultLevels()
{
self::$_levelMap = self::$_defaultLevels;
self::$_levels = array_flip(self::$_levelMap);
return self::$_levels;
}
示例2: levels
/**
* Gets/sets log levels
*
* Call this method without arguments, eg: `CakeLog::levels()` to obtain current
* level configuration.
*
* To append additional level 'user0' and 'user1' to to default log levels:
*
* {{{
* CakeLog::levels(array('user0, 'user1'));
* // or
* CakeLog::levels(array('user0, 'user1'), true);
* }}}
*
* will result in:
*
* {{{
* array(
* 0 => 'emergency',
* 1 => 'alert',
* ...
* 8 => 'user0',
* 9 => 'user1',
* );
* }}}
*
* To set/replace existing configuration, pass an array with the second argument
* set to false.
*
* {{{
* CakeLog::levels(array('user0, 'user1'), false);
* }}}
*
* will result in:
*
* {{{
* array(
* 0 => 'user0',
* 1 => 'user1',
* );
* }}}
*
* @param array $levels array
* @param boolean $append true to append, false to replace
*
* @return array Active log levels
*/
public static function levels($levels = array(), $append = true)
{
if (empty(self::$_Collection)) {
self::_init();
}
if (empty($levels)) {
return self::$_levels;
}
$levels = array_values($levels);
if ($append) {
self::$_levels = array_merge(self::$_levels, $levels);
} else {
self::$_levels = $levels;
}
self::$_levelMap = array_flip(self::$_levels);
return self::$_levels;
}