2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-23 02:31:53 +00:00

93_DbLog:V3.8.0, log events containing pipe "|" possible

git-svn-id: https://svn.fhem.de/fhem/trunk@16021 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2018-01-28 14:32:37 +00:00
parent df0f6b5353
commit 5398f96d68
2 changed files with 9 additions and 3 deletions

View File

@ -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.
- change: 93_DbLog:V3.8.0, log events containing pipe "|" possible
- bugfix: 98_TRAFFIC: v1.3.5, fixed return readings in DbLog_SplitFn
- feature: attr: -a and -r Options added (Forum #83414)
- feature: 20_FRM_IN: added Firmata 2.5 feature PIN_MODE_PULLUP

View File

@ -16,6 +16,7 @@
############################################################################################################################################
# Versions History done by DS_Starter & DeeSPe:
#
# 3.8.0 26.01.2018 escape "|" in events to log events containing it
# 3.7.1 25.01.2018 fix typo in commandref
# 3.7.0 21.01.2018 parsed event with Log 5 added, configCheck enhanced by configuration read check
# 3.6.5 19.01.2018 fix lot of logentries if disabled and db not available
@ -180,7 +181,7 @@ use Blocking;
use Time::HiRes qw(gettimeofday tv_interval);
use Encode qw(encode_utf8);
my $DbLogVersion = "3.7.1";
my $DbLogVersion = "3.8.0";
my %columns = ("DEVICE" => 64,
"TYPE" => 64,
@ -1222,6 +1223,7 @@ sub DbLog_Log($$) {
if($dev_name =~ m/^$re$/ || "$dev_name:$event" =~ m/^$re$/ || $DbLogSelectionMode eq 'Include') {
my $timestamp = $ts_0;
$timestamp = $dev_hash->{CHANGETIME}[$i] if(defined($dev_hash->{CHANGETIME}[$i]));
$event =~ s/\|/_ESC_/g; # escape Pipe "|"
my @r = DbLog_ParseEvent($dev_name, $dev_type, $event);
$reading = $r[0];
@ -1362,7 +1364,7 @@ sub DbLog_Log($$) {
return if($hash->{HELPER}{REOPEN_RUNS});
my $error = DbLog_Push($hash, $vb4show, @row_array);
Log3 $name, 5, "DbLog $name -> DbLog_Push Returncode: $error" if($vb4show);
my $state = $error?$error:(IsDisabled($name))?"disabled":"connected";
my $evt = ($state eq $hash->{HELPER}{OLDSTATE})?0:1;
readingsSingleUpdate($hash, "state", $state, $evt);
@ -1445,6 +1447,7 @@ sub DbLog_Push(@) {
foreach my $row (@row_array) {
my @a = split("\\|",$row);
s/_ESC_/\|/g for @a; # escaped Pipe return to "|"
push(@timestamp, "$a[0]");
push(@device, "$a[1]");
push(@type, "$a[2]");
@ -1850,7 +1853,8 @@ sub DbLog_PushAsync(@) {
my $ceti = $#row_array+1;
foreach my $row (@row_array) {
my @a = split("\\|",$row);
my @a = split("\\|",$row);
s/_ESC_/\|/g for @a; # escaped Pipe return to "|"
push(@timestamp, "$a[0]");
push(@device, "$a[1]");
push(@type, "$a[2]");
@ -1984,6 +1988,7 @@ sub DbLog_PushAsync(@) {
Log3 $hash->{NAME}, 4, "DbLog $name -> $ceti of $ceti events inserted into table history".($usepkh?" using PK on columns $pkh":"");
} else {
Log3 $hash->{NAME}, 4, "DbLog $name -> ".($ceti-$nins_hist)." of $ceti events inserted into table history".($usepkh?" using PK on columns $pkh":"");
s/\|/_ESC_/g for @n2hist; # escape Pipe "|"
$rowlist = join('§', @n2hist);
$rowlist = encode_base64($rowlist,"");
}