2 namespace callnotifier;
7 * Array of logger object arrays.
8 * Key is the notification type, value is an array of logger objects
9 * that want to get notified about the type.
13 protected $logger = array(
15 'edss1msg' => array(),
16 'startingCall' => array(),
17 'finishedCall' => array(),
23 * @param Logger $logger Logger object to register
24 * @param array|string $types Single notification type or array of such
25 * types. "*" means "register for all types".
29 public function addLogger(Logger $logger, $types)
32 $types = array_keys($this->logger);
34 $types = (array)$types;
36 foreach ($types as $type) {
37 if (!isset($this->logger[$type])) {
38 throw new \Exception('Unknown log type: ' . $type);
40 $this->logger[$type][] = $logger;
44 public function log($type, $arData)
46 if (!isset($this->logger[$type])) {
47 throw new \Exception('Unknown log type: ' . $type);
50 if (count($this->logger[$type])) {
51 foreach ($this->logger[$type] as $logger) {
52 $logger->log($type, $arData);