You are here

public function TestLogger::log in Configuration selector 8

Same name and namespace in other branches
  1. 8.2 src/TestLogger.php \Drupal\config_selector\TestLogger::log()
8 calls to TestLogger::log()
TestLogger::alert in src/TestLogger.php
Action must be taken immediately.
TestLogger::critical in src/TestLogger.php
Critical conditions.
TestLogger::debug in src/TestLogger.php
Detailed debug information.
TestLogger::emergency in src/TestLogger.php
System is unusable.
TestLogger::error in src/TestLogger.php
Runtime errors that do not require immediate action but should typically be logged and monitored.

... See full list

File

src/TestLogger.php, line 53

Class

TestLogger
A test logger.

Namespace

Drupal\config_selector

Code

public function log($level, $message, array $context = []) {

  // Convert levels...
  static $map = [
    RfcLogLevel::DEBUG => 'debug',
    RfcLogLevel::INFO => 'info',
    RfcLogLevel::NOTICE => 'notice',
    RfcLogLevel::WARNING => 'warning',
    RfcLogLevel::ERROR => 'error',
    RfcLogLevel::CRITICAL => 'critical',
    RfcLogLevel::ALERT => 'alert',
    RfcLogLevel::EMERGENCY => 'emergency',
  ];
  $level = isset($map[$level]) ? $map[$level] : $level;
  static::$logs[$level][] = (string) new FormattableMarkup($message, $context);
}