mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
92_FileLog.pm: better way of logging "set clear" (Forum #140177)
git-svn-id: https://svn.fhem.de/fhem/trunk@29471 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6382ab6cad
commit
d0e1a736a6
@ -206,6 +206,8 @@ FileLog_Define($@)
|
|||||||
FileLog_initEMI($hash, "addLog", undef, 1);
|
FileLog_initEMI($hash, "addLog", undef, 1);
|
||||||
my $mi = $hash->{addLogMinInterval};
|
my $mi = $hash->{addLogMinInterval};
|
||||||
InternalTimer(time()+$mi, "FileLog_addLog", $hash, 0) if($mi);
|
InternalTimer(time()+$mi, "FileLog_addLog", $hash, 0) if($mi);
|
||||||
|
delete($hash->{READINGS}{linesInTheFile})
|
||||||
|
if($hash->{READONLY} && $hash->{READINGS});
|
||||||
}, $hash);
|
}, $hash);
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
@ -478,7 +480,8 @@ FileLog_Set($@)
|
|||||||
$fh->close() if($fh);
|
$fh->close() if($fh);
|
||||||
if($cmd eq "clear") {
|
if($cmd eq "clear") {
|
||||||
$fh = new IO::File(">$cn");
|
$fh = new IO::File(">$cn");
|
||||||
setReadingsVal($hash, "linesInTheFile", 0, TimeNow());
|
setReadingsVal($hash, "linesInTheFile", 0, TimeNow())
|
||||||
|
if(!$hash->{READONLY});
|
||||||
} else {
|
} else {
|
||||||
$fh = new IO::File(">>$cn");
|
$fh = new IO::File(">>$cn");
|
||||||
}
|
}
|
||||||
@ -558,6 +561,8 @@ FileLog_Set($@)
|
|||||||
CommandDelete(undef, $victim);
|
CommandDelete(undef, $victim);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Log3 $me, 3, "set ".join(" ",@a);
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user