From 6ec5a125940846a9f7f1bb31d55b19e044db2c09 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 13 Mar 2019 17:01:30 +0100 Subject: Add debug message output to call loggers --- src/callnotifier/Log.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/callnotifier/Log.php') diff --git a/src/callnotifier/Log.php b/src/callnotifier/Log.php index d2ee0c8..a831066 100644 --- a/src/callnotifier/Log.php +++ b/src/callnotifier/Log.php @@ -3,6 +3,8 @@ namespace callnotifier; class Log { + public $debug = false; + /** * Array of logger object arrays. * Key is the notification type, value is an array of logger objects @@ -33,6 +35,10 @@ class Log } $types = (array)$types; + if ($this->debug) { + $logger->debug = $this->debug; + } + foreach ($types as $type) { if (!isset($this->logger[$type])) { throw new \Exception('Unknown log type: ' . $type); @@ -46,9 +52,12 @@ class Log if (!isset($this->logger[$type])) { throw new \Exception('Unknown log type: ' . $type); } - + if (count($this->logger[$type])) { foreach ($this->logger[$type] as $logger) { + if ($this->debug) { + echo "Logging to " . get_class($logger) . "\n"; + } $logger->log($type, $arData); } } -- cgit v1.2.3