From: Christian Weiske Date: Wed, 25 Jul 2012 16:19:25 +0000 (+0200) Subject: add cli option to activate debug log X-Git-Tag: v1.0.0~73 X-Git-Url: https://git.cweiske.de/auerswald-callnotifier.git/commitdiff_plain/522f718ee8a0be219a54ba0650f1b82b6cea3d34 add cli option to activate debug log --- diff --git a/src/callnotifier/CLI.php b/src/callnotifier/CLI.php index c8c8573..55f7f71 100644 --- a/src/callnotifier/CLI.php +++ b/src/callnotifier/CLI.php @@ -24,7 +24,13 @@ class CLI $this->fillConfig($this->config, $result); $handler = new MessageHandler($this->config); - $handler->addLogger(new Logger_Debug(), '*'); + if ($result->options['debug'] || $result->options['debugEdss1']) { + $debugLogger = new Logger_Debug(); + $handler->addLogger($debugLogger, '*'); + if ($result->options['debugEdss1']) { + $debugLogger->edss1MsgOnly = true; + } + } if ($this->config->replayFile !== null) { $sourceClass = 'callnotifier\Source_File'; @@ -71,6 +77,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; }