Jarves\Logger\JarvesHandler::write PHP Метод

write() защищенный Метод

Writes the record down to the log of the implementing handler
protected write ( array $record ) : void
$record array
Результат void
    protected function write(array $record)
    {
        if ($this->inSaving) {
            //there was a log between our ->save() method
            return;
        }
        if (!isset($this->counts[$record['level']])) {
            $this->counts[$record['level']] = 0;
        }
        $this->counts[$record['level'] + 0]++;
        if ($record['level'] < 300) {
            return;
        }
        $this->inSaving = true;
        $log = new Log();
        //
        //        if ($record['level'] == 100 && $this->getJarves()->getSystemConfig()->getLogs(true)->getPerformance()) {
        //            global $_start;
        //            static $lastDebugPoint;
        //            $timeUsed = round((microtime(true) - $_start) * 1000, 2);
        //            $bytes = convertSize(memory_get_usage(true));
        //            $last = $lastDebugPoint ? 'diff ' . round(
        //                    (microtime(true) - $lastDebugPoint) * 1000,
        //                    2
        //                ) . 'ms' : '';
        //            $lastDebugPoint = microtime(true);
        //            $log->setPerformance("memory: $bytes, {$timeUsed}ms, last: $last");
        //        }
        //
        $log->setDate(microtime(true));
        $log->setLevel($record['level']);
        $log->setMessage($record['message']);
        //        $this->getJarves()->getRequest()->get
        //        $log->setUsername(
        //            $userName = $this->getJarves()->getClient()->hasSession() && $this->getJarves()->getClient()->getUser(
        //            ) ? $this->getJarves()->getClient()->getUser()->getUsername() : 'Guest'
        //        );
        $log->setLogRequest($this->getLogRequest());
        //
        //        if ($record['level'] >= 400 || $record['level'] == 100) {
        //            if ($this->getJarves()->getSystemConfig()->getLogs(true)->getStackTrace()) {
        //                $stackTrace = debug_backtrace();
        //                $log->setStackTrace(json_encode($stackTrace));
        //            }
        //        }
        //
        try {
            $log->save();
        } catch (\Exception $e) {
        }
        $this->inSaving = false;
    }