Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BaseIO.php

function BaseIO::log

Parameters

mixed|LogLevel::* $level:

string|\Stringable $message:

Overrides LoggerInterface::log

8 calls to BaseIO::log()
BaseIO::alert in vendor/composer/composer/src/Composer/IO/BaseIO.php
BaseIO::critical in vendor/composer/composer/src/Composer/IO/BaseIO.php
BaseIO::debug in vendor/composer/composer/src/Composer/IO/BaseIO.php
BaseIO::emergency in vendor/composer/composer/src/Composer/IO/BaseIO.php
BaseIO::error in vendor/composer/composer/src/Composer/IO/BaseIO.php

... See full list

File

vendor/composer/composer/src/Composer/IO/BaseIO.php, line 247

Class

BaseIO

Namespace

Composer\IO

Code

public function log($level, $message, array $context = []) : void {
    $message = (string) $message;
    if ($context !== []) {
        $json = Silencer::call('json_encode', $context, JSON_INVALID_UTF8_IGNORE | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
        if ($json !== false) {
            $message .= ' ' . $json;
        }
    }
    if (in_array($level, [
        LogLevel::EMERGENCY,
        LogLevel::ALERT,
        LogLevel::CRITICAL,
        LogLevel::ERROR,
    ])) {
        $this->writeError('<error>' . $message . '</error>');
    }
    elseif ($level === LogLevel::WARNING) {
        $this->writeError('<warning>' . $message . '</warning>');
    }
    elseif ($level === LogLevel::NOTICE) {
        $this->writeError('<info>' . $message . '</info>', true, self::VERBOSE);
    }
    elseif ($level === LogLevel::INFO) {
        $this->writeError('<info>' . $message . '</info>', true, self::VERY_VERBOSE);
    }
    else {
        $this->writeError($message, true, self::DEBUG);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal