# HG changeset patch # User egor # Date 1496420900 -10800 # Node ID 7d7059d2a810c3548e243d0ddabcc19738a0d1f5 # Parent 93fb6c09f2e119f71accf16f15d91fb6676f4306 Подправлены пути в пакетах diff -r 93fb6c09f2e1 -r 7d7059d2a810 src/implab/components/ActivationController.js --- a/src/implab/components/ActivationController.js Fri Jun 02 18:15:22 2017 +0300 +++ b/src/implab/components/ActivationController.js Fri Jun 02 19:28:20 2017 +0300 @@ -1,4 +1,4 @@ -define([ "dojo/_base/declare", "./guard", "./safe", "./_LogMixin" ], +define([ "dojo/_base/declare", "../guard", "../safe", "../log/_LogMixin" ], function(declare, guard, safe, _LogMixin) { "use strict"; diff -r 93fb6c09f2e1 -r 7d7059d2a810 src/implab/components/StateMachine.js --- a/src/implab/components/StateMachine.js Fri Jun 02 18:15:22 2017 +0300 +++ b/src/implab/components/StateMachine.js Fri Jun 02 19:28:20 2017 +0300 @@ -1,4 +1,4 @@ -define([ "dojo/_base/declare", "./safe", "./format" ], function(declare, safe, format) { +define([ "dojo/_base/declare", "../safe", "../text/format" ], function(declare, safe, format) { return declare(null, { states : null, diff -r 93fb6c09f2e1 -r 7d7059d2a810 src/implab/components/_ActivatableMixin.js --- a/src/implab/components/_ActivatableMixin.js Fri Jun 02 18:15:22 2017 +0300 +++ b/src/implab/components/_ActivatableMixin.js Fri Jun 02 19:28:20 2017 +0300 @@ -1,4 +1,4 @@ -define([ "dojo/_base/declare", "./guard", "./StateMachine", "./_LogMixin", ], +define([ "dojo/_base/declare", "../guard", "./StateMachine", "../log/_LogMixin", ], function(declare, guard, StateMachine, _LogMixin) { diff -r 93fb6c09f2e1 -r 7d7059d2a810 src/implab/log/ConsoleLogChannel.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/implab/log/ConsoleLogChannel.js Fri Jun 02 19:28:20 2017 +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 diff -r 93fb6c09f2e1 -r 7d7059d2a810 src/implab/log/_LogMixin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/implab/log/_LogMixin.js Fri Jun 02 19:28:20 2017 +0300 @@ -0,0 +1,67 @@ +define([ "dojo/_base/declare" ], + +function(declare) { + var cls = declare(null, { + _logChannel : null, + + _logLevel : 1, + + constructor : function(opts) { + if (typeof opts == "object") { + if ("logChannel" in opts) + this._logChannel = opts.logChannel; + if ("logLevel" in opts) + this._logLevel = opts.logLevel; + } + }, + + getLogChannel : function() { + return this._logChannel; + }, + + setLogChannel : function(v) { + this._logChannel = v; + }, + + getLogLevel : function() { + return this._logLevel; + }, + + setLogLevel : function(v) { + this._logLevel = v; + }, + + log : function(format) { + if (this._logChannel && this._logLevel > 2) + this._logChannel.log.apply(this._logChannel, arguments); + }, + warn : function(format) { + if (this._logChannel && this._logLevel > 1) + this._logChannel.warn.apply(this._logChannel, arguments); + }, + error : function(format) { + if (this._logChannel && this._logLevel > 0) + this._logChannel.error.apply(this._logChannel, arguments); + }, + + /** + * Used to by widgets + */ + startup : function() { + var me = this, parent; + if (!me.getLogChannel()) { + parent = me; + while (parent = parent.getParent()) { + if (parent.getLogChannel) { + me.setLogChannel(parent.getLogChannel()); + if(parent.getLogLevel) + me.setLogLevel(parent.getLogLevel()); + break; + } + } + } + this.inherited(arguments); + } + }); + return cls; +}); \ No newline at end of file diff -r 93fb6c09f2e1 -r 7d7059d2a810 src/implab/messaging/Client.js --- a/src/implab/messaging/Client.js Fri Jun 02 18:15:22 2017 +0300 +++ b/src/implab/messaging/Client.js Fri Jun 02 19:28:20 2017 +0300 @@ -1,5 +1,5 @@ define( - [ "dojo/_base/declare", "dojo/_base/lang", "dojo/Evented", "../_LogMixin" ], + [ "dojo/_base/declare", "dojo/_base/lang", "dojo/Evented", "../log/_LogMixin" ], function(declare, lang, Evented, _LogMixin) { return declare([ Evented, _LogMixin ], { diff -r 93fb6c09f2e1 -r 7d7059d2a810 src/implab/messaging/Session.js --- a/src/implab/messaging/Session.js Fri Jun 02 18:15:22 2017 +0300 +++ b/src/implab/messaging/Session.js Fri Jun 02 19:28:20 2017 +0300 @@ -6,7 +6,7 @@ "./Destination", "dojo/Evented", "dojo/Deferred", - "../_LogMixin" ], + "../log/_LogMixin" ], function(declare, lang, request, Destination, Evented, Deferred, _LogMixin) {