diff core/src/js/log/ConsoleLogChannel.js @ 34:27e8e9e38e07 default tip

Слияние
author nickolay
date Wed, 05 Jun 2019 20:44:15 +0300
parents acdcdf1a8d21
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/src/js/log/ConsoleLogChannel.js	Wed Jun 05 20:44:15 2019 +0300
@@ -0,0 +1,30 @@
+define(
+    [ "dojo/_base/declare", "../text/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