phpMqttClient
phpMqttClient copied to clipboard
why does direct echo in processing?
no debug mode, just echo
. You will forced wrap a ob cache to flush echo message when call it in controller.
why do that? I never see a lib force run echo
.
Yes, that's just debug information. I was already thinking about removing it. Or we could could add some kind of logger to handle it. I'd be happy to just remove it for now.
Feel free to create a PR for that :slightly_smiling: This would be huge improvement for the library.
I wouldn't just remove the echo. To make it right is not that hard, right?
My favourite would be to have logger as optional dependency passed into library. So you are free to choose what ever you want. I remember there was this PSR-3 standard. Is this still the way to go?
In simple way, you can make a logger callback, and default choose echo in factory.
$client = ClientFactory::createClient(new Version4(), $dns, function ($msg) {
echo $msg;
});
// user custom
$client = ClientFactory::createClient(new Version4(), $dns, function ($msg) {
Log::debug($msg);
});