echo logger
[auerswald-callnotifier.git] / src / callnotifier / Logger / Echo.php
diff --git a/src/callnotifier/Logger/Echo.php b/src/callnotifier/Logger/Echo.php
new file mode 100644 (file)
index 0000000..eec9bb1
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+namespace callnotifier;
+
+class Logger_Echo implements Logger
+{
+    public function __construct()
+    {
+        $cc = new \Console_Color2();
+        $this->begin = $cc->convert('%y');
+        $this->end = $cc->convert('%n');
+        $this->blue = $cc->convert('%b');
+    }
+
+    public function log($type, $arData)
+    {
+        if ($type == 'msgData') {
+            echo $this->begin . $arData['type'] . $this->end
+                . ': ' . $arData['details'] . "\n";
+        } else {
+            echo $this->blue . $type . $this->end . ': '
+                . var_export($arData, true) . "\n";
+        }
+    }
+
+}
+
+?>