Log.

@param array $log The log value.
9933
public function log(array $log)
    {
        if ($this->loggerCallable) {
            call_user_func($this->loggerCallable, array_merge($this->logDefault, $log));
        }
    }
135599
public function log($message)
    {
        if (null !== $this->logger) {
            call_user_func(array($this->logger, $this->level), $message);
        }
    }
758719
public function specEnd($log = null)
    {
        switch ($log->type()) {
            case 'passed':
                $this->_write($this->_symbols['dot']);
                break;
            case 'skipped':
                $this->_write('S', 'light-grey');
                break;
            case 'pending':
                $this->_write('P', 'cyan');
                break;
            case 'excluded':
                $this->_write('X', 'yellow');
                break;
            case 'failed':
                $this->_write('F', 'red');
                break;
            case 'errored':
                $this->_write('E', 'magenta');
                break;
        }
    }
437978
public function log($message): void
	{
		$defaults = [
			'SEVERITY' => 'INFO',
			'AUDIT_TYPE_ID' => $this->auditTypeId,
			'ITEM_ID' => $this->itemId ?: '',
		];

		$message = $this->logMessToArray($message);

		CEventLog::Add(array_merge($defaults, $message, ['MODULE_ID' => $this->moduleId]));
	}
853846
protected function _reportFailure($log)
    {
        $this->_indent++;
        $type = $log->type();
        switch ($type) {
            case "failed":
                foreach ($log->children() as $expectation) {
                    if ($expectation->type() !== 'failed') {
                        continue;
                    }

                    $data = $expectation->data();
                    $isExternal = isset($data['external']) && $data['external'];

                    if ($isExternal) {
                        $this->write("expectation failed in ", 'red');
                    } else {
                        $this->write("expect->{$expectation->matcherName()}() failed in ", 'red');
                    }

                    $this->write("`{$expectation->file()}` ");
                    $this->write("line {$expectation->line()}", 'red');
                    $this->write("\n\n");

                    if ($isExternal) {
                        $this->write($data['description']);
                        $this->write("\n\n");
                    } else {
                        $this->_reportDiff($expectation);
                    }
                }
                break;
            case "errored":
                $backtrace = Debugger::backtrace(['trace' => $log->exception()]);
                $trace = reset($backtrace);
                $file = $trace['file'];
                $line = $trace['line'];

                $this->write("an uncaught exception has been thrown in ", 'magenta');
                $this->write("`{$file}` ");
                $this->write("line {$line}", 'magenta');
                $this->write("\n\n");

                $this->write('message:', 'yellow');
                $this->_reportException($log->exception());
                $this->prefix($this->format(' ', 'n;;magenta') . ' ');
                $this->write(Debugger::trace(['trace' => $backtrace]));
                $this->prefix('');
                $this->write("\n\n");
                break;
        }
        $this->_indent--;
    }
525979
public void log(final LogNode log) {
        if (log != null) {
            final LogNode scanSpecLog = log.log("ScanSpec:");
            for (final Field field : ScanSpec.class.getDeclaredFields()) {
                try {
                    scanSpecLog.log(field.getName() + ": " + field.get(this));
                } catch (final ReflectiveOperationException e) {
                    // Ignore
                }
            }
        }
    }
508811
private function _log($level, $message)
    {
        $level_config = Config::get("log_level");
        if (!$level_config) {
            $level_config = "DEBUG";
        }

        $level_val = self::$levels[$level];
        $level_config = self::$levels[$level_config];

        if ($level_config > $level_val) {
            return ;
        }

        wlog($level, $message);
    }
341618
protected function formatLog(array $log): array
    {
        foreach ($log as &$logItem) {
            if ($logItem['type'] === 'model' || $logItem['type'] === 'field') {
                $logItem['action'] = $logItem['item']['action'];
            }

            if ($logItem['type'] === 'field') {
                $logItem['field'] = $logItem['item']['field'];
            }

            $formattedItem = $this->formatItem($logItem['type'], $logItem['item']);
            unset($logItem['item']);
            $logItem += $formattedItem;

            if (!empty($logItem['message'])) {
                continue;
            }

            if (is_array($logItem['permissions']) && array_key_exists('no_bypass', $logItem['permissions'])) {
                $logItem['permissions']['NO_BYPASS'] = $logItem['permissions']['no_bypass'];
                unset($logItem['permissions']['no_bypass']);
            }

            $typeKeys = array_keys($this->lpProxy->getTypes());

            $logItem['permission_no_bypass_checks'] = array_reverse($this->getPermissionNoBypassChecks($logItem['permissions'], $logItem['context'], $typeKeys));
            if (count($logItem['permission_no_bypass_checks']) == 1 && !empty($logItem['permission_no_bypass_checks'][0]['error'])) {
                $logItem['message'] = $logItem['permission_no_bypass_checks'][0]['error'];
            }

            $logItem['bypassed_access'] = $this->getBypassedAccess($logItem['permissions'], $logItem['context']);

            $purePermissions = $logItem['permissions'];
            unset($purePermissions['NO_BYPASS']);

            $logItem['permission_checks'] = array_reverse($this->getPermissionChecks($purePermissions, $logItem['context'], $typeKeys));
            if (count($logItem['permission_checks']) == 1 && !empty($logItem['permission_checks'][0]['error'])) {
                $logItem['message'] = $logItem['permission_checks'][0]['error'];
            }

            unset($logItem['context']);
        }
        unset($logItem);

        return $log;
    }
947111
public function log(): void
    {
        $this->logger->log($this->message(), LOG_ERR, $this->tuple);
    }
416045
protected function write(array $record): void
    {
        if ($record['level'] < Logger::NOTICE) {
            $this->handleDebugRecord($record);
        } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Throwable) {
            $this->handleExceptionRecord($record);
        } else {
            $this->handleErrorRecord($record);
        }
    }
86482
public function setLogLevel($level)
    {
        $this->logLevelSet = true;
        if ($level != $this->getLogLevel()) {
            $this->logLevel = $level;
            $this->info("Setting loglevel to $level");
        }
    }
90987
protected function _reportSpecMessage($log)
    {
        $messages = $log->messages();
        $message = end($messages);

        switch ($log->type()) {
            case 'passed':
                $this->write($this->_symbols['ok'], 'light-green');
                $this->write(' ');
                $this->write("{$message}\n", 'dark-grey');
                break;
            case 'skipped':
                $this->write($this->_symbols['ok'], 'light-grey');
                $this->write(' ');
                $this->write("{$message}\n", 'light-grey');
                break;
            case 'pending':
                $this->write($this->_symbols['ok'], 'cyan');
                $this->write(' ');
                $this->write("{$message}\n", 'cyan');
                break;
            case 'excluded':
                $this->write($this->_symbols['ok'], 'yellow');
                $this->write(' ');
                $this->write("{$message}\n", 'yellow');
                break;
            case 'failed':
                $this->write($this->_symbols['err'], 'red');
                $this->write(' ');
                $this->write("{$message}\n", 'red');
                break;
            case 'errored':
                $this->write($this->_symbols['err'], 'red');
                $this->write(' ');
                $this->write("{$message}\n", 'red');
                break;
        }
    }
1186969
protected function _addLog($value)
    {
        if ($this->_maximumLog >= 0 && count($this->_log) >= $this->_maximumLog) {
            array_shift($this->_log);
        }

        $this->_log[] = $value;
    }
364387
public function logQuery(array $query)
    {
        $this->queries[] = $query;

        if ($this->logger) {
            $this->logger->info('MongoDB Query: '.json_encode($query));
        }
    }
379858
public function log($message)
    {

        if (!empty($this->log_file)) {
            //echo $message;
            \file_put_contents($this->log_file, "\n" . $message, \FILE_APPEND);
        }
    }
979947
protected function processLogs($logs)
	{
		$message='';
		foreach($logs as $log)
			$message.=$this->formatLogMessage($log[0],$log[1],$log[2],$log[3]);
		$message=wordwrap($message,70);
		$subject=$this->getSubject();
		if($subject===null)
			$subject=Yii::t('yii','Application Log');
		foreach($this->getEmails() as $email)
			$this->sendEmail($email,$subject,$message);
	}
420835
public function append($log)
    {
        /**
         * @var \ManaPHP\DbInterface $db
         */
        $db = $this->_di->getShared($this->_db);

        $level = $this->logger->getLevel();
        $this->logger->setLevel(Logger::LEVEL_FATAL);
        try {
            $db->insert($this->_table, [
                'host' => $log->host,
                'client_ip' => $log->client_ip,
                'request_id' => $log->request_id,
                'category' => $log->category,
                'level' => $log->level,
                'file' => $log->file,
                'line' => $log->line,
                'message' => $log->message,
                'timestamp' => $log->timestamp - (int)$log->timestamp,
                'created_time' => (int)$log->timestamp]);
        } catch (\Exception $e) {
            null;
        }
        $this->logger->setLevel($level);
    }