1: <?php
2:
3: namespace Guzzle\Log;
4:
5: use Psr\Log\LogLevel;
6: use Psr\Log\LoggerInterface;
7:
8: /**
9: * PSR-3 log adapter
10: *
11: * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
12: */
13: class PsrLogAdapter extends AbstractLogAdapter
14: {
15: /**
16: * syslog to PSR-3 mappings
17: */
18: private static $mapping = array(
19: LOG_DEBUG => LogLevel::DEBUG,
20: LOG_INFO => LogLevel::INFO,
21: LOG_WARNING => LogLevel::WARNING,
22: LOG_ERR => LogLevel::ERROR,
23: LOG_CRIT => LogLevel::CRITICAL,
24: LOG_ALERT => LogLevel::ALERT
25: );
26:
27: /**
28: * {@inheritdoc}
29: */
30: public function __construct(LoggerInterface $logObject)
31: {
32: $this->log = $logObject;
33: }
34:
35: /**
36: * {@inheritdoc}
37: */
38: public function log($message, $priority = LOG_INFO, $extras = null)
39: {
40:
41: $this->log->log(self::$mapping[$priority], $message, $extras);
42: }
43: }
44: