/**
  * @group utility
  */
 function testIsLogLevel()
 {
     $this->assertFalse(InputValidator::isLogLevel("Some String"));
     $this->assertFalse(InputValidator::isLogLevel(3));
     $this->assertFalse(InputValidator::isLogLevel(null));
     $this->assertFalse(InputValidator::isLogLevel(1.2));
     $this->assertFalse(InputValidator::isLogLevel("notification"));
     $this->assertTrue(InputValidator::isLogLevel("NOTIFICATION"));
 }
示例#2
0
 /**
  * This function sets the log level. The following elements are possible:
  * <ul>
  *   <li>NOTIFICATION</li>
  *   <li>WARNING</li>
  *   <li>ERROR</li>
  * </ul>
  *
  * @param String $level	The log level to set.
  */
 public static function setLogLevel($level)
 {
     if (!InputValidator::isLogLevel($level)) {
         return;
     }
     self::$LOGLEVEL = $level;
 }
示例#3
0
 /**
  * This function sets the log level.
  *
  * @author David Pauli <*****@*****.**>
  * @since 0.0.0
  * @since 0.0.1 Use LogLevel enum.
  * @since 0.0.3 Set php error reporting automatically in developing systems.
  * @api
  * @param LogLevel $level The log level to set.
  */
 public static function setLogLevel($level)
 {
     if (!InputValidator::isLogLevel($level)) {
         return;
     }
     // set PHP error reporting
     switch ($level) {
         case LogLevel::ERROR:
             error_reporting(E_ERROR);
             ini_set("display_errors", 1);
             break;
         case LogLevel::NOTIFICATION:
             error_reporting(E_ALL);
             ini_set("display_errors", 1);
             break;
         case LogLevel::WARNING:
             error_reporting(E_WARNING);
             ini_set("display_errors", 1);
             break;
         default:
             ini_set("display_errors", 0);
     }
     self::$LOGLEVEL = $level;
 }