2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

removing deprecated GetLogLevel() and replace it with Log3()

git-svn-id: https://svn.fhem.de/fhem/trunk@3723 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2013-08-17 11:32:09 +00:00
parent 8a426ad9b6
commit 54e614fa03

View File

@ -419,20 +419,20 @@ PRESENCE_Read($)
}
elsif($buf =~ /socket_closed;(.+?)$/)
{
Log GetLogLevel($hash->{NAME}, 3), "PRESENCE: collectord lost connection to room $1 for device ".$hash->{NAME};
Log3 $hash->{NAME}, 3, "PRESENCE: collectord lost connection to room $1 for device ".$hash->{NAME};
}
elsif($buf =~ /socket_reconnected;(.+?)$/)
{
Log GetLogLevel($hash->{NAME}, 3), "PRESENCE: collectord reconnected to room $1 for device ".$hash->{NAME};
Log3 $hash->{NAME}, 3, "PRESENCE: collectord reconnected to room $1 for device ".$hash->{NAME};
}
elsif($buf =~ /error;(.+?)$/)
{
Log GetLogLevel($hash->{NAME}, 3), "PRESENCE: room $1 cannot execute hcitool to check device ".$hash->{NAME};
Log3 $hash->{NAME}, 3, "PRESENCE: room $1 cannot execute hcitool to check device ".$hash->{NAME};
}
elsif($buf =~ /error$/)
{
Log GetLogLevel($hash->{NAME}, 3), "PRESENCE: presenced cannot execute hcitool to check device ".$hash->{NAME};
Log3 $hash->{NAME}, 3, "PRESENCE: presenced cannot execute hcitool to check device ".$hash->{NAME};
}
readingsEndUpdate($hash, 1);
@ -506,7 +506,7 @@ PRESENCE_DoLocalPingScan($)
my ($string) = @_;
my ($name, $device, $local, $count) = split("\\|", $string);
Log GetLogLevel($defs{$name}{NAME}, 5), "PRESENCE_DoLocalPingScan: $string";
Log3 $name, 5, "PRESENCE_DoLocalPingScan: $string";
my $retcode;
my $return;
@ -521,7 +521,7 @@ PRESENCE_DoLocalPingScan($)
{
$retcode = $pingtool->ping($device, 5);
Log GetLogLevel($name, 5), "PRESENCE ($name) - pingtool returned $retcode";
Log3 $name, 5, "PRESENCE ($name) - pingtool returned $retcode";
$return = "$name|$local|".($retcode ? "present" : "absent");
}
@ -535,7 +535,7 @@ PRESENCE_DoLocalPingScan($)
{
$temp = qx(ping -c $count $device);
Log GetLogLevel($name, 5), "PRESENCE ($name) - ping command returned with output:\n$temp";
Log3 $name, 5, "PRESENCE ($name) - ping command returned with output:\n$temp";
$return = "$name|$local|".($temp =~ /\d+ [Bb]ytes (from|von)/ ? "present" : "absent");
}
@ -554,7 +554,7 @@ PRESENCE_ExecuteFritzBoxCMD($$)
while(-e "/var/tmp/fhem-PRESENCE-cmd-lock.tmp" and (stat("/var/tmp/fhem-PRESENCE-cmd-lock.tmp"))[9] > (gettimeofday() - 2))
{
$wait = int(rand(4))+2;
Log GetLogLevel($name, 5), "PRESENCE_ExecuteFritzBoxCMD: ($name) - ctlmgr_ctl is locked. waiting $wait seconds...";
Log3 $name, 5, "PRESENCE_ExecuteFritzBoxCMD: ($name) - ctlmgr_ctl is locked. waiting $wait seconds...";
sleep $wait;
}
@ -575,7 +575,7 @@ PRESENCE_DoLocalFritzBoxScan($)
my ($string) = @_;
my ($name, $device, $local, $repeater) = split("\\|", $string);
Log GetLogLevel($defs{$name}{NAME}, 5), "PRESENCE_DoLocalFritzBoxScan: $string";
Log3 $name, 5, "PRESENCE_DoLocalFritzBoxScan: $string";
my $number=0;
my $check_command = ($repeater ? "active" : "speed");
@ -587,7 +587,7 @@ PRESENCE_DoLocalFritzBoxScan($)
{
$number = $defs{$name}{helper}{cachednr};
Log GetLogLevel($name, 5), "PRESENCE_DoLocalFritzBoxScan: try checking $name as device $device with cached number $number";
Log3 $name, 5, "PRESENCE_DoLocalFritzBoxScan: try checking $name as device $device with cached number $number";
my $cached_name = PRESENCE_ExecuteFritzBoxCMD($name, "/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/name");
chomp $cached_name;
@ -595,12 +595,12 @@ PRESENCE_DoLocalFritzBoxScan($)
# only use the cached $number if it has still the correct device name
if($cached_name eq $device)
{
Log GetLogLevel($name, 5), "PRESENCE ($name) - checking with cached number the $check_command state ($number)";
Log3 $name, 5, "PRESENCE ($name) - checking with cached number the $check_command state ($number)";
$status = PRESENCE_ExecuteFritzBoxCMD($name, "/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/$check_command");
chomp $status;
Log GetLogLevel($name, 5), "PRESENCE ($name) - ctlmgr_ctl (cached: $number) returned: $status";
Log3 $name, 5, "PRESENCE ($name) - ctlmgr_ctl (cached: $number) returned: $status";
if(not $status =~ /^\s*\d+\s*$/)
{
@ -610,7 +610,7 @@ PRESENCE_DoLocalFritzBoxScan($)
}
else
{
Log GetLogLevel($name, 5), "PRESENCE ($name) - cached device name ($cached_name) does not match expected name ($device). perform a full scan";
Log3 $name, 5, "PRESENCE ($name) - cached device name ($cached_name) does not match expected name ($device). perform a full scan";
}
}
@ -618,7 +618,7 @@ PRESENCE_DoLocalFritzBoxScan($)
chomp $max;
Log GetLogLevel($name, 5), "PRESENCE ($name) - ctlmgr_ctl (getting device count) returned: $max";
Log3 $name, 5, "PRESENCE ($name) - ctlmgr_ctl (getting device count) returned: $max";
if(not $max =~ /^\s*\d+\s*$/)
{
@ -637,14 +637,14 @@ PRESENCE_DoLocalFritzBoxScan($)
chomp $net_device;
Log GetLogLevel($name, 5), "PRESENCE ($name) - checking with device number $number the $check_command state ($net_device)";
Log3 $name, 5, "PRESENCE ($name) - checking with device number $number the $check_command state ($net_device)";
if($net_device eq $device)
{
$status = PRESENCE_ExecuteFritzBoxCMD($name, "/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/$check_command");
chomp $status;
Log GetLogLevel($name, 5), "PRESENCE ($name) - $check_command for device number $net_device is $status";
Log3 $name, 5, "PRESENCE ($name) - $check_command for device number $net_device is $status";
last;
}
@ -667,7 +667,7 @@ PRESENCE_DoLocalBluetoothScan($)
my $wait = 1;
my $ps;
Log GetLogLevel($name, 4), "PRESENCE ($name): 'which hcitool' returns: $hcitool";
Log3 $name, 4, "PRESENCE ($name): 'which hcitool' returns: $hcitool";
chomp $hcitool;
@ -679,7 +679,7 @@ PRESENCE_DoLocalBluetoothScan($)
if(not $ps =~ /^\s*$/)
{
# sleep between 1 and 5 seconds and try again
Log GetLogLevel($name, 5), "PRESENCE ($name) - another hcitool command is running. waiting...";
Log3 $name, 5, "PRESENCE ($name) - another hcitool command is running. waiting...";
sleep(rand(4)+1);
}
else
@ -691,7 +691,7 @@ PRESENCE_DoLocalBluetoothScan($)
$devname = qx(hcitool name $device);
chomp($devname);
Log GetLogLevel($name, 4), "PRESENCE ($name) - hcitool returned: $devname";
Log3 $name, 4, "PRESENCE ($name) - hcitool returned: $devname";
if(not $devname =~ /^\s*$/)
{
@ -720,7 +720,7 @@ PRESENCE_DoLocalShellScriptScan($)
my $ret;
my $return;
Log GetLogLevel($name, 5), "PRESENCE_DoLocalShellScriptScan: $string";
Log3 $name, 5, "PRESENCE_DoLocalShellScriptScan: $string";
$ret = qx($call);
@ -762,7 +762,7 @@ PRESENCE_DoLocalFunctionScan($)
my $ret;
my $return;
Log GetLogLevel($name, 5), "PRESENCE_DoLocalFunctionScan: $string";
Log3 $name, 5, "PRESENCE_DoLocalFunctionScan: $string";
$ret = AnalyzeCommandChain(undef, $call);
@ -808,12 +808,12 @@ PRESENCE_ProcessLocalScan($)
my $local = $a[1];
Log GetLogLevel($hash->{NAME}, 5), "PRESENCE_ProcessLocalScan: $string";
Log3 $hash->{NAME}, 5, "PRESENCE_ProcessLocalScan: $string";
if(defined($hash->{helper}{RETRY_COUNT}))
{
Log GetLogLevel($hash->{NAME}, 2), "PRESENCE: ".$hash->{NAME}." returned a valid result after ".$hash->{helper}{RETRY_COUNT}." unsuccesful ".($hash->{helper}{RETRY_COUNT} > 1 ? "retries" : "retry");
Log3 $hash->{NAME}, 2, "PRESENCE: ".$hash->{NAME}." returned a valid result after ".$hash->{helper}{RETRY_COUNT}." unsuccesful ".($hash->{helper}{RETRY_COUNT} > 1 ? "retries" : "retry");
delete($hash->{helper}{RETRY_COUNT});
}
@ -842,7 +842,7 @@ PRESENCE_ProcessLocalScan($)
{
$a[3] =~ s/<<line-break>>/\n/g;
Log GetLogLevel($hash->{NAME}, 2), "PRESENCE: error while processing device ".$hash->{NAME}." - ".$a[3];
Log3 $hash->{NAME}, 2, "PRESENCE: error while processing device ".$hash->{NAME}." - ".$a[3];
}
readingsEndUpdate($hash, 1);
@ -871,13 +871,13 @@ PRESENCE_ProcessAbortedScan($)
{
if($hash->{helper}{RETRY_COUNT} >= 3)
{
Log GetLogLevel($hash->{NAME}, 2), "PRESENCE: ".$hash->{NAME}." could not be checked after ".$hash->{helper}{RETRY_COUNT}." ".($hash->{helper}{RETRY_COUNT} > 1 ? "retries" : "retry"). " (resuming normal operation)" if($hash->{helper}{RETRY_COUNT} == 3);
Log3 $hash->{NAME}, 2, "PRESENCE: ".$hash->{NAME}." could not be checked after ".$hash->{helper}{RETRY_COUNT}." ".($hash->{helper}{RETRY_COUNT} > 1 ? "retries" : "retry"). " (resuming normal operation)" if($hash->{helper}{RETRY_COUNT} == 3);
InternalTimer(gettimeofday()+10, "PRESENCE_StartLocalScan", $hash, 0) unless($hash->{helper}{DISABLED});
$hash->{helper}{RETRY_COUNT}++;
}
else
{
Log GetLogLevel($hash->{NAME}, 2), "PRESENCE: ".$hash->{NAME}." could not be checked after ".$hash->{helper}{RETRY_COUNT}." ".($hash->{helper}{RETRY_COUNT} > 1 ? "retries" : "retry")." (retrying in 10 seconds)";
Log3 $hash->{NAME}, 2, "PRESENCE: ".$hash->{NAME}." could not be checked after ".$hash->{helper}{RETRY_COUNT}." ".($hash->{helper}{RETRY_COUNT} > 1 ? "retries" : "retry")." (retrying in 10 seconds)";
InternalTimer(gettimeofday()+10, "PRESENCE_StartLocalScan", $hash, 0) unless($hash->{helper}{DISABLED});
$hash->{helper}{RETRY_COUNT}++;
}