mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 11:26:55 +00:00
92_FileLog.pm: add cross-file-border patch (Forum #41791)
git-svn-id: https://svn.fhem.de/fhem/trunk@9815 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c63c9984a2
commit
1c69000c74
@ -574,10 +574,38 @@ FileLog_Get($@)
|
||||
if($from =~ m/^(....)-(..)-(..)/) {
|
||||
$linf = $hash->{logfile};
|
||||
my ($Y,$m,$d) = ($1,$2,$3);
|
||||
$linf =~ s/%Y/$Y/g;
|
||||
$linf =~ s/%m/$m/g;
|
||||
$linf =~ s/%d/$d/g;
|
||||
$linf =~ s/%L/$attr{global}{logdir}/g if($attr{global}{logdir});
|
||||
sub expandFileWildcards($$$$) {
|
||||
my $f=shift;
|
||||
my ($Y,$m,$d)=@_;
|
||||
$f =~ s/%Y/$Y/g;
|
||||
$f =~ s/%m/$m/g;
|
||||
$f =~ s/%d/$d/g;
|
||||
$f =~ s/%L/$attr{global}{logdir}/g if($attr{global}{logdir});
|
||||
return($f);
|
||||
};
|
||||
$linf=expandFileWildcards($linf,$Y,$m,$d);
|
||||
if($to =~ m/^(....)-(..)-(..)/) {
|
||||
my $linf_to = $hash->{logfile};
|
||||
my ($Y,$m,$d) = ($1,$2,$3);
|
||||
$linf_to=expandFileWildcards($linf_to,$Y,$m,$d);
|
||||
if(!($linf_to =~ m/%/)){
|
||||
if($linf ne $linf_to){ # use to log files
|
||||
my $tempread=$linf_to.".transit.temp.log";
|
||||
if(open(my $temp,'>',$tempread)){
|
||||
if(open(my $i,'<',$linf)){
|
||||
print $temp join("",<$i>);
|
||||
close($i);
|
||||
}
|
||||
if(open(my $i,'<',$linf_to)){
|
||||
print $temp join("",<$i>);
|
||||
close($i);
|
||||
}
|
||||
$linf=$tempread;
|
||||
close($temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$linf = $hash->{currentlogfile} if($linf =~ m/%/ || ! -f $linf);
|
||||
} else {
|
||||
$linf = $hash->{currentlogfile};
|
||||
|
Loading…
x
Reference in New Issue
Block a user