Runtime errors that do not require immediate action but should typically
be logged and monitored.

@param string|array $channel
@param string|array $message
@param array        $context

@return static
@throws \Exception
7108
public function error($channel, $message, array $context = [])
    {
        $this->log($channel, LogLevel::ERROR, $message, $context);

        return $this;
    }
691946
public function debug($message, array $context = [])
    {
        $this->checkInitialized();

        foreach ($this->loggers as $logger) {
            $logger->debug($message, $context);
        }
    }
805437
public function log($level, $message, array $context = []): void
    {
        if (!isset($this->logLevels[$level])) {
            $level = LogLevel::DEBUG;
        }

        $this->exceptionFile = null;

        if ($this->logLevels[$level] < $this->level) {
            return;
        }

        $exceptionFile = null;
        if (isset($context['exception']) && $context['exception'] instanceof \Throwable) {
            $exceptionFile = $this->getExceptionFile($context['exception']);
        }

        if (SEASLOG_EXTENSION) {
            $message .= $exceptionFile ? ' @@  ' . \basename($exceptionFile) : '';

            \SeasLog::log($level, $message, $context);
        } else {
            $message = Dumper::interpolate($message, $context);

            $line = static::formatLogLine($message, $exceptionFile);
            $file = $this->directory . '/' . $level . '.log';

            if (!@\file_put_contents($file, $line . PHP_EOL, FILE_APPEND | LOCK_EX)) { // @ is escalated to exception
                throw new \RuntimeException("Unable to write to log file '$file'. Is directory writable?");
            }
        }

        if ($exceptionFile) {
            $this->logException($context['exception'], $exceptionFile);
        }

        if (\in_array($level, [LogLevel::ERROR, LogLevel::EMERGENCY, LogLevel::CRITICAL, LogLevel::ALERT], true)) {
            $this->sendEmail($message);
        }

        $this->exceptionFile = $exceptionFile;
    }
173456
public function error($message, array $context = array()) {
        $context['fromClass'] = get_called_class();
        foreach ($this->loggersInstances as $logger) {
            $logger->error($message, $context);
        }
    }
461694
public function log($level, $message, array $context = array())
    {
        $this->checkLevel($level);
        $prefix = $this->colorsEnabled ?
            ColorHelper::colorString(strtoupper("[{$level}]"), $this->getFGColor($level), $this->getBGColor($level)) :
            strtoupper("[{$level}]");
        $message = $this->interpolate($message, $context);
        if (isset($context['exception']) && $context['exception'] instanceof \Exception) {
            $message .= PHP_EOL . $this->handleException($context['exception']);
        }
        $message = $this->processMultiline($level, $message);
        fputs($this->getOutputStream($level), "{$prefix}: $message" . PHP_EOL);
    }
1339605
protected function log($message, $context)
    {
        $logger = $this->getLogger();
        if ($logger !== null) {
            $logger->error($message, $context);
        }
    }
751468
protected function logDebug($message, array $context = [])
    {
        $this->hasLogger() === true ?: $this->logger->debug($message, $context);
    }
1078761
public function log($level, $message, array $context = [])
    {
        $title = 'Log '.$level;
        if (isset($context['title'])) {
            $title = $context['title'];
            unset($context['title']);
        }

        $exception = null;
        if (isset($context['exception']) && ($context['exception'] instanceof Exception || $context['exception'] instanceof Throwable)) {
            $exception = $context['exception'];
            unset($context['exception']);
        } elseif ($message instanceof Exception || $message instanceof Throwable) {
            $exception = $message;
        }

        // Below theshold, leave a breadcrumb but don't send a notification
        if (!$this->aboveLevel($level, $this->notifyLevel)) {
            if ($exception !== null) {
                $title = get_class($exception);
                $data = ['name' => $title, 'message' => $exception->getMessage()];
            } else {
                $data = ['message' => $message];
            }

            $metaData = array_merge($data, $context);

            $this->client->leaveBreadcrumb($title, 'log', array_filter($metaData));

            return;
        }

        $severityReason = [
            'type' => 'log',
            'attributes' => [
                'level' => $level,
            ],
        ];

        if ($exception !== null) {
            $report = Report::fromPHPThrowable($this->client->getConfig(), $exception);
        } else {
            $report = Report::fromNamedError($this->client->getConfig(), $title, $this->formatMessage($message));
        }

        $report->setMetaData($context);
        $report->setSeverity($this->getSeverity($level));
        $report->setSeverityReason($severityReason);

        $this->client->notify($report);
    }
1284461
public function logException($level, $message, array $context = [], $exception = null)
    {
        $this->log($level, $message, array_merge($context, ['exception'=>$exception]));
    }
783191
public function debug($message, array $context = array())
    {
        if (self::isSetLogger()) {
            return self::$logger->debug($message, $context);
        }

        return false;
    }
1334139
public function debug($message, array $context = array())
    {
        // TODO: Implement debug() method.
        return $this->addRecord(\Psr\Log\LogLevel::DEBUG, $message, $context);
    }
395395
public function err($message, array $context = array())
    {
        return $this->_instance->addRecord(\Monolog\Logger::ERROR, $message, $context);
    }
706515
public function log($level, $message, array $context = [])
    {
        $context_output = empty($context) ? '' : sprintf(' :: %s', json_encode($context));

        $logline = sprintf("[%s] %s%s\n", strtoupper($level), $message, $context_output);

        $handle = in_array($level, self::ERROR_LEVELS, false) ? STDERR : STDOUT;

        fwrite($handle, $logline);
    }
863617
public function log($channel, $level, $message, $context = '') {
        if (!$this->enabled) {
            return;
        }

        $message = ltrim($message);

        global $wpdb;

        $query = $wpdb->prepare("insert into {$this->table} (date, channel, level, message, context) values (%s, %s, %s, %s, %s)", current_time('mysql', true), $channel, $level, $message, $context);
        $wpdb->query($query);
    }
1218894
public function pushErrorLog($message, array $context = [])
    {
        if ($this->logFile) {
            Log::getInstance([
                'channel' => 'ERROR-SQL',
                'level' => 'info',
                'maxSize' => 1000000, // default
            ])->pushInfo($message, $context);
        }
    }
700200
public function beginEmergency(string $message, array $context = []) {
        return $this->begin(LogLevel::EMERGENCY, $message, $context);
    }
300241
public function emergency($message, array $context = array())
    {
        try
        {
            return $this->logger->emergency($message, $context);
        }
        catch (Error $ex)
        {}
        catch (Exception $ex)
        {}

        throw new WriteException("Record with debug level could not be logged.", 0, $ex);
    }