Mercurial > pub > ImplabJs
diff src/implab/components/_LogMixin.js @ 3:00779cb63b12
formatting
author | cin |
---|---|
date | Tue, 06 Jun 2017 19:45:32 +0300 |
parents | fc2517695ee1 |
children |
line wrap: on
line diff
--- a/src/implab/components/_LogMixin.js Fri Jun 02 19:28:20 2017 +0300 +++ b/src/implab/components/_LogMixin.js Tue Jun 06 19:45:32 2017 +0300 @@ -1,12 +1,12 @@ -define([ "dojo/_base/declare" ], - -function(declare) { +define([ + "implab/declare", "implab/declare/override" +], function (declare, override) { var cls = declare(null, { - _logChannel : null, + _logChannel: null, - _logLevel : 1, + _logLevel: 1, - constructor : function(opts) { + constructor: function (opts) { if (typeof opts == "object") { if ("logChannel" in opts) this._logChannel = opts.logChannel; @@ -15,31 +15,31 @@ } }, - getLogChannel : function() { + getLogChannel: function () { return this._logChannel; }, - setLogChannel : function(v) { + setLogChannel: function (v) { this._logChannel = v; }, - getLogLevel : function() { + getLogLevel: function () { return this._logLevel; }, - setLogLevel : function(v) { + setLogLevel: function (v) { this._logLevel = v; }, - log : function(format) { + log: function () { if (this._logChannel && this._logLevel > 2) this._logChannel.log.apply(this._logChannel, arguments); }, - warn : function(format) { + warn: function () { if (this._logChannel && this._logLevel > 1) this._logChannel.warn.apply(this._logChannel, arguments); }, - error : function(format) { + error: function () { if (this._logChannel && this._logLevel > 0) this._logChannel.error.apply(this._logChannel, arguments); }, @@ -47,21 +47,22 @@ /** * Used to by widgets */ - startup : function() { - var me = this, parent; + startup: override( /** @this */ function (inherited) { + var me = this, + parent; if (!me.getLogChannel()) { parent = me; - while (parent = parent.getParent()) { + while ((parent = parent.getParent())) { if (parent.getLogChannel) { me.setLogChannel(parent.getLogChannel()); - if(parent.getLogLevel) + if (parent.getLogLevel) me.setLogLevel(parent.getLogLevel()); break; } } } - this.inherited(arguments); - } + return inherited(); + }) }); return cls; }); \ No newline at end of file