mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
98_FhemTestUtils.pm: add FhemTestUtils_getLogTime (Forum #111061)
git-svn-id: https://svn.fhem.de/fhem/trunk@22660 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
abc589e6fd
commit
7fb5da6b1f
@ -73,6 +73,22 @@ FhemTestUtils_resetLogs()
|
||||
@logs=();
|
||||
}
|
||||
|
||||
sub
|
||||
FhemTestUtils_getLogTime
|
||||
{
|
||||
my $arg = shift;
|
||||
|
||||
foreach my $line (@logs) {
|
||||
if($line =~ m/^([0-9\.]+ [0-9:\.]+)\s.*$arg/ms) {
|
||||
my @a = split("[\. :]", $1);
|
||||
my $time = mktime($a[5],$a[4],$a[3],$a[2],$a[1]-1,$a[0]-1900,0,0,-1);
|
||||
$time += $a[6]/1000 if(@a == 7); # attrg global mseclog is active
|
||||
return $time;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
@ -99,6 +115,9 @@ FhemTestUtils_resetLogs()
|
||||
Return the logs matching the regexp argument (with grep).
|
||||
Note, that loglevel filtering with verbose ist still active.
|
||||
</li>
|
||||
<li>FhemTestUtils_getLogTime($)<br>
|
||||
Return the timestamp of the first log matching the argument.
|
||||
</li>
|
||||
<li>FhemTestUtils_resetEvents()<br>
|
||||
Reset the internal event buffer.
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user