2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 04:36:36 +00:00

fhem.pl: implement ignoreRegexp for the global FHEM log (Forum #104520)

git-svn-id: https://svn.fhem.de/fhem/trunk@20827 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-12-25 19:17:36 +00:00
parent 48bff22f9a
commit 90e6c462d2
4 changed files with 25 additions and 2 deletions

View File

@ -778,8 +778,8 @@ END
<li>ignoreRegexp regexp<br>
Es ist nicht immer einfach ein Regexp zu bauen, was etwas _nicht_
matcht. Dieses Attribu hilft in diesen F&auml;llen: das Event wird
ignoriert, falls den angegebenen Regexp. Syntax ist gleich wie in der
Definition.
ignoriert, falls den angegebenen Regexp matcht. Syntax ist gleich wie
in der Definition.
</li>
<a name="readLog"></a>

View File

@ -1567,6 +1567,13 @@ The following local attributes are used by a wider range of devices:
compression by default. Set httpcompress to 0 to disable this feature.
</li><br>
<a name="ignoreRegexp"></a>
<li>ignoreRegexp<br>
Do not log messages matching the value into the FHEM log. Note: the
usual ^ and $ will be appended to the regexp, like in notify or
FileLog.
</li><br>
<a name="keyFileName"></a>
<li>keyFileName<br>
FHEM modules store passwords and unique IDs in the file

View File

@ -1671,6 +1671,13 @@ Die folgenden lokalen Attribute werden von mehreren Ger&auml;ten verwendet:
httpcompress auf 0 setzt, wird die Komprimierung deaktiviert.
</li><br>
<a name="ignoreRegexp"></a>
<li>ignoreRegexp<br>
Texte, wo dieses Regexp matcht, werden nicht geloggt. ^ und $ wird zum
Regexp hinzugef&uuml;gt, wie bei notify und FileLog.
</li><br>
<a name="keyFileName"></a>
<li>keyFileName<br>
FHEM Module speichern Passw&ouml;rter und IDs in der Datei

View File

@ -303,6 +303,7 @@ my @cmdList; # Remaining commands in a chain. Used by sleep
my %sleepers; # list of sleepers
my %delayedShutdowns; # definitions needing delayed shutdown
my %fuuidHash; # for duplicate checking
my $ignoreRegexp; # for Log filtering
$init_done = 0;
$lastDefChange = 0;
@ -338,6 +339,7 @@ my @globalAttrList = qw(
genericDisplayType:switch,outlet,light,blind,speaker,thermostat
holiday2we
httpcompress:0,1
ignoreRegexp
keyFileName
language:EN,DE
lastinclude
@ -969,6 +971,7 @@ Log3($$$)
return if($loglevel > $attr{global}{verbose});
}
return if($ignoreRegexp && $text =~ m/^$ignoreRegexp$/);
my ($seconds, $microseconds) = gettimeofday();
my @t = localtime($seconds);
@ -2752,6 +2755,7 @@ GlobalAttr($$$$)
return "The global attribute $name cannot be deleted" if($noDel{$name});
$featurelevel = 5.9 if($name eq "featurelevel");
$haveInet6 = 0 if($name eq "useInet6"); # IPv6
$ignoreRegexp = 0 if($name eq "ignoreRegexp");
return undef;
}
@ -2846,6 +2850,11 @@ GlobalAttr($$$$)
$haveInet6 = 0;
}
}
elsif($name eq "ignoreRegexp") {
eval { "Hallo" =~ m/^$val$/ };
return $@ if($@);
$ignoreRegexp = $val;
}
return undef;
}