git.cweiske.de
/
auerswald-callnotifier.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fc64778
)
decode debug bytes and display them in echo logger
author
Christian Weiske
<cweiske@cweiske.de>
Sun, 15 Jul 2012 20:48:25 +0000
(22:48 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Sun, 15 Jul 2012 20:48:25 +0000
(22:48 +0200)
src/callnotifier/Logger/Echo.php
patch
|
blob
|
history
diff --git
a/src/callnotifier/Logger/Echo.php
b/src/callnotifier/Logger/Echo.php
index eec9bb15dae3d14c11df7966ef8702469b114a48..c716db893cfcc1814f169b77cc5c168710ce162d 100644
(file)
--- 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->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)
}
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 ($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";
} else {
echo $this->blue . $type . $this->end . ': '
. var_export($arData, true) . "\n";