public function handle(
            int $level,
            string $message,
            string $file = null,
            int $line = null,
            array $context = []
    ): bool
    {
        $logData  = date('Y-m-d H:i:s') . '|' . $level;
        $logData .= '|' . (self::$levelStrings[$level] ?? 'unknown');
        $logData .= '|' . $message;
        $logData .= '|' . $file;
        $logData .= '|' . $line;
        $logDir   = $this->buildLogDir();
        if (!file_exists($logDir)) {
            mkdir($logDir, $this->filemode, true);
        }

        error_log(
                $logData . "\n",
                3,
                $logDir . DIRECTORY_SEPARATOR . 'php-error-' . date('Y-m-d') . '.log'
        );
        return ErrorHandler::STOP_ERROR_HANDLING;
    }
public function handle(
            int $level,
            string $message,
            string $file = null,
            int $line = null,
            array $context = []
    ): bool
    {
        $logData  = date('Y-m-d H:i:s') . '|' . $level;
        $logData .= '|' . (self::$levelStrings[$level] ?? 'unknown');
        $logData .= '|' . $message;
        $logData .= '|' . $file;
        $logData .= '|' . $line;
        $logDir   = $this->buildLogDir();
        if (!file_exists($logDir)) {
            mkdir($logDir, $this->filemode, true);
        }

        error_log(
                $logData . "\n",
                3,
                $logDir . DIRECTORY_SEPARATOR . 'php-error-' . date('Y-m-d') . '.log'
        );
        return ErrorHandler::STOP_ERROR_HANDLING;
    }
public function handle ( int $ level , string $ message , string $ file = null , int $ line = null , array $ context = [ ] ) : bool { $ logData = date ( 'Y-m-d H:i:s' ) . '|' . $ level ; $ logData .= '|' . ( self :: $ levelStrings [ $ level ] ?? 'unknown' ) ; $ logData .= '|' . $ message ; $ logData .= '|' . $ file ; $ logData .= '|' . $ line ; $ logDir = $ this -> buildLogDir ( ) ; if ( ! file_exists ( $ logDir ) ) { mkdir ( $ logDir , $ this -> filemode , true ) ; } error_log ( $ logData . "\n" , 3 , $ logDir . DIRECTORY_SEPARATOR . 'php-error-' . date ( 'Y-m-d' ) . '.log' ) ; return ErrorHandler :: STOP_ERROR_HANDLING ; }
handles the given error

@param   int     $level    level of the raised error
@param   string  $message  error message
@param   string  $file     filename that the error was raised in
@param   int     $line     line number the error was raised at
@param   array   $context  array of every variable that existed in the scope the error was triggered in
@return  bool    true if error message should populate $php_errormsg, else false
handles the given error