trait RfcLoggerTrait
Same name in other branches
- 9 core/lib/Drupal/Core/Logger/RfcLoggerTrait.php \Drupal\Core\Logger\RfcLoggerTrait
- 8.9.x core/lib/Drupal/Core/Logger/RfcLoggerTrait.php \Drupal\Core\Logger\RfcLoggerTrait
- 10 core/lib/Drupal/Core/Logger/RfcLoggerTrait.php \Drupal\Core\Logger\RfcLoggerTrait
A copy of \Psr\Log\LoggerTrait that uses RFC 5424 compliant log levels.
Internal Drupal logger implementations should use this trait instead of \Psr\Log\LoggerTrait. Callers of those implementations are responsible for translating any other log level format to RFC 5424 compliant integers.
Hierarchy
- trait \Drupal\Core\Logger\RfcLoggerTrait
See also
https://groups.google.com/forum/#!topic/php-fig/Rc5YDhNdGz4
https://www.drupal.org/node/2267545
5 files declare their use of RfcLoggerTrait
- ConfigImporterMissingContentTest.php in core/
tests/ Drupal/ KernelTests/ Core/ Config/ ConfigImporterMissingContentTest.php - DbLog.php in core/
modules/ dblog/ src/ Logger/ DbLog.php - SecurityAdvisoriesFetcherTest.php in core/
modules/ system/ tests/ src/ Kernel/ SecurityAdvisories/ SecurityAdvisoriesFetcherTest.php - SysLog.php in core/
modules/ syslog/ src/ Logger/ SysLog.php - TestLog.php in core/
modules/ system/ tests/ modules/ error_service_test/ src/ Logger/ TestLog.php
File
-
core/
lib/ Drupal/ Core/ Logger/ RfcLoggerTrait.php, line 15
Namespace
Drupal\Core\LoggerView source
trait RfcLoggerTrait {
/**
* {@inheritdoc}
*/
public function emergency(string|\Stringable $message, array $context = []) : void {
$this->log(RfcLogLevel::EMERGENCY, $message, $context);
}
/**
* {@inheritdoc}
*/
public function alert(string|\Stringable $message, array $context = []) : void {
$this->log(RfcLogLevel::ALERT, $message, $context);
}
/**
* {@inheritdoc}
*/
public function critical(string|\Stringable $message, array $context = []) : void {
$this->log(RfcLogLevel::CRITICAL, $message, $context);
}
/**
* {@inheritdoc}
*/
public function error(string|\Stringable $message, array $context = []) : void {
$this->log(RfcLogLevel::ERROR, $message, $context);
}
/**
* {@inheritdoc}
*/
public function warning(string|\Stringable $message, array $context = []) : void {
$this->log(RfcLogLevel::WARNING, $message, $context);
}
/**
* {@inheritdoc}
*/
public function notice(string|\Stringable $message, array $context = []) : void {
$this->log(RfcLogLevel::NOTICE, $message, $context);
}
/**
* {@inheritdoc}
*/
public function info(string|\Stringable $message, array $context = []) : void {
$this->log(RfcLogLevel::INFO, $message, $context);
}
/**
* {@inheritdoc}
*/
public function debug(string|\Stringable $message, array $context = []) : void {
$this->log(RfcLogLevel::DEBUG, $message, $context);
}
/**
* {@inheritdoc}
*/
public abstract function log($level, string|\Stringable $message, array $context = []) : void;
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
RfcLoggerTrait::alert | public | function | ||
RfcLoggerTrait::critical | public | function | ||
RfcLoggerTrait::debug | public | function | ||
RfcLoggerTrait::emergency | public | function | ||
RfcLoggerTrait::error | public | function | ||
RfcLoggerTrait::info | public | function | ||
RfcLoggerTrait::log | abstract public | function | 5 | |
RfcLoggerTrait::notice | public | function | ||
RfcLoggerTrait::warning | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.