2 namespace callnotifier;
4 class Logger_Echo implements Logger
6 public function __construct()
8 $cc = new \Console_Color2();
9 $this->begin = $cc->convert('%y');
10 $this->end = $cc->convert('%n');
11 $this->blue = $cc->convert('%b');
12 $this->red = $cc->convert('%r');
13 $this->white = $cc->convert('%w');
16 public function log($type, $arData)
18 if ($type == 'msgData') {
19 echo $this->begin . $arData['type'] . $this->end
20 . ': ' . $arData['details'] . "\n";
21 if (preg_match('#^[A-Z][0-9]{2}: (.+)$#', $arData['details'], $matches)) {
22 $bytestring = $matches[1];
24 foreach (explode(' ', $bytestring) as $strbyte) {
25 $line .= chr(hexdec($strbyte));
29 $this->white . '?' . $this->end,
32 echo $this->red . ' bytes' . $this->end . ': ' . $line . "\n";
35 echo $this->blue . $type . $this->end . ': '
36 . var_export($arData, true) . "\n";