X-Git-Url: https://git.cweiske.de/auerswald-callnotifier.git/blobdiff_plain/fc647788cf137595e84bea72edb16d86ab1d76a5..29ff32499e239e6189b80ef3b9e76384920205a7:/src/callnotifier/CLI.php diff --git a/src/callnotifier/CLI.php b/src/callnotifier/CLI.php index f9a4937..8958f78 100644 --- a/src/callnotifier/CLI.php +++ b/src/callnotifier/CLI.php @@ -23,8 +23,23 @@ class CLI $this->fillConfig($this->config, $result); - $handler = new MessageHandler($this->config); - $handler->addLogger(new Logger_Echo(), '*'); + $log = new Log(); + if ($result->options['debug'] || $result->options['debugEdss1']) { + $debugLogger = new Logger_Debug(); + $log->addLogger($debugLogger, '*'); + if ($result->options['debugEdss1']) { + $debugLogger->edss1MsgOnly = true; + } + } + $log->addLogger( + new Logger_CallEcho(), array('startingCall', 'finishedCall') + ); + + $callMonitor = new CallMonitor($this->config, $log); + $callMonitor->addDetailler(new CallMonitor_Detailler_LDAP()); + $callMonitor->addDetailler(new CallMonitor_Detailler_OpenGeoDb()); + + $handler = new MessageHandler($this->config, $log, $callMonitor); if ($this->config->replayFile !== null) { $sourceClass = 'callnotifier\Source_File'; @@ -71,6 +86,25 @@ class CLI ) ); + $p->addOption( + 'debug', + array( + 'short_name' => '-d', + 'long_name' => '--debug', + 'description' => "Debug mode: Echo all received messages and events", + 'action' => 'StoreTrue' + ) + ); + $p->addOption( + 'debugEdss1', + array( + 'short_name' => '-e', + 'long_name' => '--debug-edss1', + 'description' => "Debug mode: Show EDSS1 messages only", + 'action' => 'StoreTrue' + ) + ); + $this->cliParser = $p; }