add more logs

master
Dirk Heilig 2024-09-23 11:43:48 +02:00
parent 10a7b9591a
commit 1f069904bc
1 changed files with 21 additions and 16 deletions

View File

@ -95,13 +95,17 @@ logit( "Subscribed");
$timer = 0; $timer = 0;
logit("Started listening for incoming messages\n will wait 60 seconds before starting to export data"); logit(
"Started listening for incoming messages\n will wait 60 seconds before starting to export data"
);
$realStart = time() + 15; $realStart = time() + 15;
logit( "waiting till " . logit(
"waiting till " .
date("Y-m-d H:i:s", $realStart) . date("Y-m-d H:i:s", $realStart) .
" that's in " . " that's in " .
($realStart - time()) . ($realStart - time()) .
" seconds"); " seconds"
);
while (time() < $realStart) { while (time() < $realStart) {
$wait = time() + 5; $wait = time() + 5;
$mqtt->loop(5000); $mqtt->loop(5000);
@ -117,9 +121,10 @@ while ($isRunning) {
$mqtt->loop(1000); $mqtt->loop(1000);
if ($lastGC + 60 < time()) { if ($lastGC + 60 < time()) {
gc_collect_cycles(); logit("doing Garbage collection...");
$c = gc_collect_cycles();
logit("Garbage collection done, $c cycles collected");
$lastGC = time(); $lastGC = time();
logit("doint GC");
} }
if ($loopEnd > microtime(true)) { if ($loopEnd > microtime(true)) {
@ -387,8 +392,8 @@ function endit(): void
error("Exiting"); error("Exiting");
} }
function logit(): void
function logit():void{ {
echo date("[Y-m-d H:i:s]") . " " . implode(" ", func_get_args()) . "\n"; echo date("[Y-m-d H:i:s]") . " " . implode(" ", func_get_args()) . "\n";
} }