1: <?php
2: /**
3: * The Log Decorator logs error events when they are pushed on the stack.
4: *
5: * Copyright 2001-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (LGPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
9: *
10: * @author Jan Schneider <jan@horde.org>
11: * @category Horde
12: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
13: * @package Notification
14: */
15: class Horde_Notification_Handler_Decorator_Log
16: extends Horde_Notification_Handler_Decorator_Base
17: {
18: /**
19: * The log handler.
20: *
21: * @var object
22: */
23: private $_logger;
24:
25: /**
26: * Constructor.
27: *
28: * @param object $logger The log handler. The provided instance is
29: * required to implement the debug() function. You
30: * should be able to use a common Logger here (PEAR
31: * Log, Horde_Log_Logger, or Zend_Log).
32: */
33: public function __construct($logger)
34: {
35: $this->_logger = $logger;
36: }
37:
38: /**
39: * Event is being added to the Horde message stack.
40: *
41: * @param Horde_Notification_Event $event Event object.
42: * @param array $options Additional options (see
43: * Horde_Notification_Handler for
44: * details).
45: */
46: public function push(Horde_Notification_Event $event, $options)
47: {
48: $this->_logger->debug($event->message);
49: }
50:
51: }
52: