示例#1
0
 /**
  * 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
0
 /**
  * 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;
 }