X-Git-Url: https://git.cweiske.de/auerswald-callnotifier.git/blobdiff_plain/fc647788cf137595e84bea72edb16d86ab1d76a5..1350411a5e11e720eb7c7f528f6d579322f6021c:/src/callnotifier/Logger/Echo.php diff --git a/src/callnotifier/Logger/Echo.php b/src/callnotifier/Logger/Echo.php index eec9bb1..c716db8 100644 --- a/src/callnotifier/Logger/Echo.php +++ b/src/callnotifier/Logger/Echo.php @@ -9,6 +9,8 @@ class Logger_Echo implements Logger $this->begin = $cc->convert('%y'); $this->end = $cc->convert('%n'); $this->blue = $cc->convert('%b'); + $this->red = $cc->convert('%r'); + $this->white = $cc->convert('%w'); } public function log($type, $arData) @@ -16,6 +18,19 @@ class Logger_Echo implements Logger if ($type == 'msgData') { echo $this->begin . $arData['type'] . $this->end . ': ' . $arData['details'] . "\n"; + if (preg_match('#^[A-Z][0-9]{2}: (.+)$#', $arData['details'], $matches)) { + $bytestring = $matches[1]; + $line = ''; + foreach (explode(' ', $bytestring) as $strbyte) { + $line .= chr(hexdec($strbyte)); + } + $line = preg_replace( + '/[^[:print:]]/', + $this->white . '?' . $this->end, + $line + ); + echo $this->red . ' bytes' . $this->end . ': ' . $line . "\n"; + } } else { echo $this->blue . $type . $this->end . ': ' . var_export($arData, true) . "\n";