aboutsummaryrefslogtreecommitdiff
path: root/src/callnotifier/Log.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2019-03-13 17:01:30 +0100
committerChristian Weiske <cweiske@cweiske.de>2019-03-13 17:01:30 +0100
commit6ec5a125940846a9f7f1bb31d55b19e044db2c09 (patch)
treef7ec307cee6309d6b91783b23dfe616e8ba40cbe /src/callnotifier/Log.php
parentd0ff3140a682f3adfd906bdb7ef116ba830ceeec (diff)
downloadauerswald-callnotifier-6ec5a125940846a9f7f1bb31d55b19e044db2c09.tar.gz
auerswald-callnotifier-6ec5a125940846a9f7f1bb31d55b19e044db2c09.zip
Add debug message output to call loggers
Diffstat (limited to 'src/callnotifier/Log.php')
-rw-r--r--src/callnotifier/Log.php11
1 files changed, 10 insertions, 1 deletions
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);
}
}