diff src/implab/log/listeners/console.js @ 24:f750c89976d3

Added trace tools, implab/log/trace!<channel-name>, <channel-name> is optional
author cin
date Thu, 07 Dec 2017 19:19:29 +0300
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/implab/log/listeners/console.js	Thu Dec 07 19:19:29 2017 +0300
@@ -0,0 +1,25 @@
+define([], function () {
+    if (console && console.log)
+        return function (ch, name, msg) {
+            
+            var args = [ch + ":"];
+
+            switch (name) {
+                case "warn":
+                case "error":
+                case "log":
+                    break;
+                default:
+                    args.push(name + ":");
+                    name = "log";
+            }
+
+
+            if (msg instanceof Array)
+                args.push.apply(args, msg);
+            else
+                args.push(msg);
+
+            console[name].apply(console, args);
+        };
+});
\ No newline at end of file