Use base64 instead of hex to display binary in some places

base64 takes less space than hex, which is beneficial for logging larger payloads.
This commit is contained in:
Dylan K. Taylor
2019-06-06 14:43:20 +01:00
parent 80f8a27094
commit eb161f8e1c
5 changed files with 8 additions and 9 deletions

View File

@ -112,7 +112,6 @@ use function array_sum;
use function asort;
use function assert;
use function base64_encode;
use function bin2hex;
use function class_exists;
use function count;
use function define;
@ -2528,7 +2527,7 @@ class Server{
if(strlen($payload) > 2 and substr($payload, 0, 2) === "\xfe\xfd" and $this->queryHandler instanceof QueryHandler){
$this->queryHandler->handle($interface, $address, $port, $payload);
}else{
$this->logger->debug("Unhandled raw packet from $address $port: " . bin2hex($payload));
$this->logger->debug("Unhandled raw packet from $address $port: " . base64_encode($payload));
}
}catch(\Throwable $e){
$this->logger->logException($e);