mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-24 02:59:22 +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:
parent
df0f6b5353
commit
5398f96d68
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# 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
|
- bugfix: 98_TRAFFIC: v1.3.5, fixed return readings in DbLog_SplitFn
|
||||||
- feature: attr: -a and -r Options added (Forum #83414)
|
- feature: attr: -a and -r Options added (Forum #83414)
|
||||||
- feature: 20_FRM_IN: added Firmata 2.5 feature PIN_MODE_PULLUP
|
- feature: 20_FRM_IN: added Firmata 2.5 feature PIN_MODE_PULLUP
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
############################################################################################################################################
|
############################################################################################################################################
|
||||||
# Versions History done by DS_Starter & DeeSPe:
|
# 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.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.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
|
# 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 Time::HiRes qw(gettimeofday tv_interval);
|
||||||
use Encode qw(encode_utf8);
|
use Encode qw(encode_utf8);
|
||||||
|
|
||||||
my $DbLogVersion = "3.7.1";
|
my $DbLogVersion = "3.8.0";
|
||||||
|
|
||||||
my %columns = ("DEVICE" => 64,
|
my %columns = ("DEVICE" => 64,
|
||||||
"TYPE" => 64,
|
"TYPE" => 64,
|
||||||
@ -1222,6 +1223,7 @@ sub DbLog_Log($$) {
|
|||||||
if($dev_name =~ m/^$re$/ || "$dev_name:$event" =~ m/^$re$/ || $DbLogSelectionMode eq 'Include') {
|
if($dev_name =~ m/^$re$/ || "$dev_name:$event" =~ m/^$re$/ || $DbLogSelectionMode eq 'Include') {
|
||||||
my $timestamp = $ts_0;
|
my $timestamp = $ts_0;
|
||||||
$timestamp = $dev_hash->{CHANGETIME}[$i] if(defined($dev_hash->{CHANGETIME}[$i]));
|
$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);
|
my @r = DbLog_ParseEvent($dev_name, $dev_type, $event);
|
||||||
$reading = $r[0];
|
$reading = $r[0];
|
||||||
@ -1362,7 +1364,7 @@ sub DbLog_Log($$) {
|
|||||||
return if($hash->{HELPER}{REOPEN_RUNS});
|
return if($hash->{HELPER}{REOPEN_RUNS});
|
||||||
my $error = DbLog_Push($hash, $vb4show, @row_array);
|
my $error = DbLog_Push($hash, $vb4show, @row_array);
|
||||||
Log3 $name, 5, "DbLog $name -> DbLog_Push Returncode: $error" if($vb4show);
|
Log3 $name, 5, "DbLog $name -> DbLog_Push Returncode: $error" if($vb4show);
|
||||||
|
|
||||||
my $state = $error?$error:(IsDisabled($name))?"disabled":"connected";
|
my $state = $error?$error:(IsDisabled($name))?"disabled":"connected";
|
||||||
my $evt = ($state eq $hash->{HELPER}{OLDSTATE})?0:1;
|
my $evt = ($state eq $hash->{HELPER}{OLDSTATE})?0:1;
|
||||||
readingsSingleUpdate($hash, "state", $state, $evt);
|
readingsSingleUpdate($hash, "state", $state, $evt);
|
||||||
@ -1445,6 +1447,7 @@ sub DbLog_Push(@) {
|
|||||||
|
|
||||||
foreach my $row (@row_array) {
|
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(@timestamp, "$a[0]");
|
||||||
push(@device, "$a[1]");
|
push(@device, "$a[1]");
|
||||||
push(@type, "$a[2]");
|
push(@type, "$a[2]");
|
||||||
@ -1850,7 +1853,8 @@ sub DbLog_PushAsync(@) {
|
|||||||
my $ceti = $#row_array+1;
|
my $ceti = $#row_array+1;
|
||||||
|
|
||||||
foreach my $row (@row_array) {
|
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(@timestamp, "$a[0]");
|
||||||
push(@device, "$a[1]");
|
push(@device, "$a[1]");
|
||||||
push(@type, "$a[2]");
|
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":"");
|
Log3 $hash->{NAME}, 4, "DbLog $name -> $ceti of $ceti events inserted into table history".($usepkh?" using PK on columns $pkh":"");
|
||||||
} else {
|
} else {
|
||||||
Log3 $hash->{NAME}, 4, "DbLog $name -> ".($ceti-$nins_hist)." of $ceti events inserted into table history".($usepkh?" using PK on columns $pkh":"");
|
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 = join('§', @n2hist);
|
||||||
$rowlist = encode_base64($rowlist,"");
|
$rowlist = encode_base64($rowlist,"");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user