1
0

debugging

This commit is contained in:
2022-01-28 23:05:58 +01:00
parent 1361cb9395
commit 425107cec7
22 changed files with 167 additions and 136 deletions

View File

@ -1,5 +1,5 @@
<?php
logger(DEBUG,"Including db.php");
logger(DEBUG, _("Including db.php"));
class db extends mysqli
{
@ -19,13 +19,13 @@ class db extends mysqli
}
while ($this->connect($this->mysqlServer, $this->username, $this->passwd, $this->database) === false)
{
logger(ERROR,_("Connection to sql server error :") . $this->connect_error);
logger(ERROR,_("Connection to sql server error :") . $this->connect_error, __FILE__ . ":" . __LINE__);
sleep(5);
$flagError = true;
}
if ($flagError === true)
{
logger(ERROR, _("Connection to sql server ready"));
logger(ERROR, _("Connection to sql server ready"), __FILE__ . ":" . __LINE__);
}
$result = new mysqli_result($this);
}
@ -56,7 +56,7 @@ class db extends mysqli
$minMax = $minMax($value);
}
echo "minMax = " .$minMax . EOL;
//echo "minMax = " .$minMax . EOL;
//echo "oldValue = " . $oldValue . EOL;
//echo "Value = " . $value . EOL;
if ($value >= $oldValue - $minMax and $value <= $oldValue + $minMax)
@ -67,15 +67,15 @@ class db extends mysqli
}
if ($testMode)
{
logger(INFO, _("Test mode on: not storing in DB "));
logger(INFO, _("Test mode on: not storing in DB "), __FILE__ . ":" . __LINE__);
}else
{
if(!$this->result = $this->query($query))
{
logger(ERROR, _("mysql query errror: ") . $this->error);
logger(ERROR, _("mysql query errror: ") . $this->error, __FILE__ . ":" . __LINE__);
}
}
logger(INFO, sprintf(_("New value of property: '%s' of device: %s stored in database"), $propertyTree, $device->friendlyName, $value));
logger(INFO, sprintf(_("New value of property: '%s' of device: %s stored in database"), $propertyTree, $device->friendlyName, $value), __FILE__ . ":" . __LINE__);
}
}
}

View File

@ -26,31 +26,31 @@ class hook
{
foreach ($this->devicelist as $ieeeAddress => $property2change)
{
logger(DEBUG, _("Device: ") . $ieeeAddress);
logger(DEBUG, _("Device: ") . $ieeeAddress, __FILE__ . ":" . __LINE__);
if ($property2change[1] === false)
{
logger(DEBUG, _("Trying to store callback"));
logger(DEBUG, _("Trying to store callback"), __FILE__ . ":" . __LINE__);
if (isset($indexDevices[$ieeeAddress]))
{
$property = $property2change[0];
$indexDevices[$ieeeAddress]->$property["functions"][] = array($this,"callback");
$property2change[1] = true;
logger(DEBUG, sprintf(_("Property '%s' is initialized with callback"), $property2change[0]));
logger(DEBUG, sprintf(_("Property '%s' is initialized with callback"), $property2change[0]), __FILE__ . ":" . __LINE__);
}else
{
logger(WARNING, sprintf(_("Hook %s can not initialize Property '%s' of device %s"), $this->hookName, $property2change[0], $ieeeAddress));
logger(WARNING, sprintf(_("Hook %s can not initialize Property '%s' of device %s"), $this->hookName, $property2change[0], $ieeeAddress), __FILE__ . ":" . __LINE__);
$result = false;
}
}else
{
logger(DEBUG, _("Callback already installed"));
logger(DEBUG, _("Callback already installed"), __FILE__ . ":" . __LINE__);
}
}
//echo "result => "; var_dump($result);
if ($result === true)
{
$this->initialized = true;
logger(DEBUG, $this->hookName . (" initialized"));
logger(DEBUG, $this->hookName . _(" initialized"), __FILE__ . ":" . __LINE__);
//var_dump($this);
}
}

View File

@ -1,5 +1,5 @@
<?php
logger(DEBUG,"Including class main.php");
logger(DEBUG, _("Including class main.php"), __FILE__ . ":" . __LINE__);
class Message
{