diff src/implab/components/ConsoleLogChannel.js @ 0:fc2517695ee1

Initial commit, draft import of existing work
author cin
date Thu, 01 Jun 2017 13:20:03 +0300
parents
children 93fb6c09f2e1
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/implab/components/ConsoleLogChannel.js	Thu Jun 01 13:20:03 2017 +0300
@@ -0,0 +1,30 @@
+define(
+    [ "dojo/_base/declare", "./format" ],
+    function(declare, format) {
+        return declare(
+            null,
+            {
+                name : null,
+
+                constructor : function(name) {
+                    this.name = name;
+                },
+
+                log : function() {
+                    console.log(this._makeMsg(arguments));
+                },
+
+                warn : function() {
+                    console.warn(this._makeMsg(arguments));
+                },
+
+                error : function() {
+                    console.error(this._makeMsg(arguments));
+                },
+
+                _makeMsg : function(args) {
+                    return this.name ? this.name + " " +
+                        format.apply(null, args) : format.apply(null, args);
+                }
+            });
+    });
\ No newline at end of file