3 namespace Drupal\Core\Logger;
6 * A copy of \Psr\Log\LoggerTrait that uses RFC 5424 compliant log levels.
8 * Internal Drupal logger implementations should use this trait instead of
9 * \Psr\Log\LoggerTrait. Callers of those implementations are responsible for
10 * translating any other log level format to RFC 5424 compliant integers.
12 * @see https://groups.google.com/forum/#!topic/php-fig/Rc5YDhNdGz4
13 * @see https://www.drupal.org/node/2267545
15 trait RfcLoggerTrait {
20 public function emergency($message, array $context = []) {
21 $this->log(RfcLogLevel::EMERGENCY, $message, $context);
27 public function alert($message, array $context = []) {
28 $this->log(RfcLogLevel::ALERT, $message, $context);
34 public function critical($message, array $context = []) {
35 $this->log(RfcLogLevel::CRITICAL, $message, $context);
41 public function error($message, array $context = []) {
42 $this->log(RfcLogLevel::ERROR, $message, $context);
48 public function warning($message, array $context = []) {
49 $this->log(RfcLogLevel::WARNING, $message, $context);
55 public function notice($message, array $context = []) {
56 $this->log(RfcLogLevel::NOTICE, $message, $context);
62 public function info($message, array $context = []) {
63 $this->log(RfcLogLevel::INFO, $message, $context);
69 public function debug($message, array $context = []) {
70 $this->log(RfcLogLevel::DEBUG, $message, $context);
76 abstract public function log($level, $message, array $context = []);