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