From e3f5399e87479113c2147a4bcdf9d6fe55beb29b Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Tue, 1 Aug 2017 10:01:20 +0000 Subject: [PATCH] fhem.pl: add -d option for debugging (Forum #74774) git-svn-id: https://svn.fhem.de/fhem/trunk@14828 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/fhem.pl | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/fhem/CHANGED b/fhem/CHANGED index f03687402..b4fb841ff 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: fhem.pl: add -d option for debugging (Forum #74774) - bugfix: 74_AMADDevice: fix decode_utf8 call in eval - feature: 57_Calendar: reduce memory footprint (forum #74481) - bugfix: 74_AMADDevice: fix openurl bug diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 2232d75f3..8ca91b004 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -399,6 +399,9 @@ $readingFnAttributes = "event-on-change-reading event-on-update-reading ". ################################################### # Start the program +my $fhemdebug; +$fhemdebug = shift @ARGV if($ARGV[0] eq "-d"); + if(int(@ARGV) < 1) { print "Usage:\n"; print "as server: fhem configfile\n"; @@ -2751,6 +2754,10 @@ CommandAttr($$) } } + if($fhemdebug && $sdev eq "global") { + $a[2] = "-" if($attrName eq "logfile"); + $a[2] = 5 if($attrName eq "verbose"); + } $ret = CallFn($sdev, "AttrFn", "set", @a); if($ret) { push @rets, $ret; @@ -3960,6 +3967,10 @@ setGlobalAttrBeforeFork($) my ($n,$v) = ($1,$2); $v =~ s/#.*//; $v =~ s/ .*$//; + if($fhemdebug) { + $v = "-" if($n eq "logfile"); + $v = 5 if($n eq "verbose"); + } $attr{global}{$n} = $v; GlobalAttr("set", "global", $n, $v); }