src/sb/Logger/Syslog.php
protected function checkLength($str, $max_length = '', $type = 'packet')
    {
        $max_length = $max_length ? $max_length : $this->max_length;
        if ($max_length == -1) {
            return $str;
        }

        $strlen = strlen($str);
        if ($strlen > $max_length) {
            throw new \Exception("Syslog " . $type . " is > " . $max_length . " (" . $strlen . ") in length and will be truncated.  Original str is: " . $str, E_USER_WARNING);
            return substr($str, 0, $max_length);
        }

        return $str;
    }
protected function checkLength($str, $max_length = '', $type = 'packet')
    {
        $max_length = $max_length ? $max_length : $this->max_length;
        if ($max_length == -1) {
            return $str;
        }

        $strlen = strlen($str);
        if ($strlen > $max_length) {
            throw new \Exception("Syslog " . $type . " is > " . $max_length . " (" . $strlen . ") in length and will be truncated.  Original str is: " . $str, E_USER_WARNING);
            return substr($str, 0, $max_length);
        }

        return $str;
    }
protected function checkLength ( $ str , $ max_length = '' , $ type = 'packet' ) { $ max_length = $ max_length ? $ max_length : $ this -> max_length ; if ( $ max_length == - 1 ) { return $ str ; } $ strlen = strlen ( $ str ) ; if ( $ strlen > $ max_length ) { throw new \ Exception ( "Syslog " . $ type . " is > " . $ max_length . " (" . $ strlen . ") in length and will be truncated.  Original str is: " . $ str , E_USER_WARNING ) ; return substr ( $ str , 0 , $ max_length ) ; } return $ str ; }
Checks to make sure the length of something is expected or warn and truncate
@param string $str The string to check
@param int $max_length The maximun length to check for, -1 means infinite length
@param string $type The type of thing to check packet or process
@return string The string truncated to max length
Checks to make sure the length of something is expected or warn and truncate