/** * Constructor... * * @param String $message * @param String $level * @param String $code * @param Array $data */ public function __construct($message, $level, $code, array $data = array()) { $code = \r8\str\stripW($code, "_"); if (\r8\isEmpty($code)) { throw new \r8\Exception\Argument(2, 'Code', 'Can only contain Numbers, Strings and Underscores'); } $this->message = (string) $message; $this->level = \r8\Log\Level::resolveValue($level); $this->code = (string) $code; $this->data = $data; $this->time = \microtime(TRUE); }
/** * Returns the syslog level a message should be logged as part of * * @param String $level The Message Level to resolve * @return Integer */ public static function getSysLogLevel($level) { $map = array(\r8\Log\Level::EMERGENCY => \LOG_EMERG, \r8\Log\Level::ALERT => \LOG_ALERT, \r8\Log\Level::CRITICAL => \LOG_CRIT, \r8\Log\Level::ERROR => \LOG_ERR, \r8\Log\Level::WARNING => \LOG_WARNING, \r8\Log\Level::NOTICE => \LOG_NOTICE, \r8\Log\Level::INFO => \LOG_INFO, \r8\Log\Level::DEBUG => \LOG_DEBUG); return $map[\r8\Log\Level::resolveValue($level)]; }
/** * Constructor... * * @param Array $levels The list of levels that will match against a message */ public function __construct(array $levels) { $this->levels = \array_filter($levels, function ($level) { return \r8\Log\Level::resolveValue($level); }); }