1 | <?php |
||
5 | class Logger |
||
6 | { |
||
7 | const LOG_ERROR = 'error'; |
||
8 | const LOG_DEPRECATED = 'deprecated'; |
||
9 | const LOG_DEBUG = 'debug'; |
||
10 | |||
11 | /** @var Logger[] */ |
||
12 | static protected $instances; |
||
13 | |||
14 | /** @var string what kind of log is this */ |
||
15 | protected $facility; |
||
16 | |||
17 | /** |
||
18 | * Logger constructor. |
||
19 | * |
||
20 | * @param string $facility The type of log |
||
21 | */ |
||
22 | protected function __construct($facility) |
||
26 | |||
27 | /** |
||
28 | * Return a Logger instance for the given facility |
||
29 | * |
||
30 | * @param string $facility The type of log |
||
31 | * @return Logger |
||
32 | */ |
||
33 | static public function getInstance($facility = self::LOG_ERROR) |
||
40 | |||
41 | /** |
||
42 | * Log a message to the facility log |
||
43 | * |
||
44 | * @param string $message The log message |
||
45 | * @param mixed $details Any details that should be added to the log entry |
||
46 | * @param string $file A source filename if this is related to a source position |
||
47 | * @param int $line A line number for the above file |
||
48 | * @return bool |
||
49 | */ |
||
50 | public function log($message, $details = null, $file = '', $line = 0) |
||
74 | |||
75 | /** |
||
76 | * Write the given lines to today's facility log |
||
77 | * |
||
78 | * @param string[] $lines the raw lines to append to the log |
||
79 | * @return bool true if the log was written |
||
80 | */ |
||
81 | protected function writeLogLines($lines) |
||
87 | } |
||
88 |