From 522f718ee8a0be219a54ba0650f1b82b6cea3d34 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 25 Jul 2012 18:19:25 +0200 Subject: [PATCH] add cli option to activate debug log --- src/callnotifier/CLI.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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; } -- 2.30.2