Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* @file
* Contains \Drupal\Core\Logger\RfcLoggerTrait.
*/
namespace Drupal\Core\Logger;
/**
* 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.
*
* @see https://groups.google.com/forum/#!topic/php-fig/Rc5YDhNdGz4
* @see https://www.drupal.org/node/2267545
*/
trait RfcLoggerTrait {
/**
* Implements \Psr\Log\LoggerInterface::emergency()
*/
public function emergency($message, array $context = array()) {
$this->log(RfcLogLevel::EMERGENCY, $message, $context);
}
/**
* Implements \Psr\Log\LoggerInterface::alert()
*/
public function alert($message, array $context = array()) {
$this->log(RfcLogLevel::ALERT, $message, $context);
}
/**
* Implements \Psr\Log\LoggerInterface::critical()
*/
public function critical($message, array $context = array()) {
$this->log(RfcLogLevel::CRITICAL, $message, $context);
}
/**
* Implements \Psr\Log\LoggerInterface::error()
*/
public function error($message, array $context = array()) {
$this->log(RfcLogLevel::ERROR, $message, $context);
}
/**
* Implements \Psr\Log\LoggerInterface::warning()
*/
public function warning($message, array $context = array()) {
$this->log(RfcLogLevel::WARNING, $message, $context);
}
/**
* Implements \Psr\Log\LoggerInterface::notice()
*/
public function notice($message, array $context = array()) {
$this->log(RfcLogLevel::NOTICE, $message, $context);
}
/**
* Implements \Psr\Log\LoggerInterface::info()
*/
public function info($message, array $context = array()) {
$this->log(RfcLogLevel::INFO, $message, $context);
}
/**
* Implements \Psr\Log\LoggerInterface::debug()
*/
public function debug($message, array $context = array()) {
$this->log(RfcLogLevel::DEBUG, $message, $context);
}
/**
* Implements \Psr\Log\LoggerInterface::log()
*/
abstract public function log($level, $message, array $context = array());
}