Skip to content

Commit 3f9d1ed

Browse files
committed
Refactored debug functions.
1 parent 5fc4b48 commit 3f9d1ed

33 files changed

+690
-42
lines changed

sampleProjects/com/mindScriptAct/mvcExpressVisualizer/VisualLoggerTestModule.as

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public class VisualLoggerTestModule extends ModuleSprite {
5454
}
5555
super(ModuleNames.SHELL);
5656
//
57-
this.stage.align = StageAlign.TOP_LEFT;
5857
this.stage.scaleMode = StageScaleMode.NO_SCALE;
5958
}
6059

src/org/mvcexpress/core/CommandMap.as

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import flash.utils.getDefinitionByName;
66
import flash.utils.getQualifiedClassName;
77
import org.mvcexpress.core.messenger.Messenger;
88
import org.mvcexpress.core.namespace.pureLegsCore;
9+
import org.mvcexpress.core.traceObjects.TraceCommandMap_execute;
10+
import org.mvcexpress.core.traceObjects.TraceCommandMap_handleCommandExecute;
11+
import org.mvcexpress.core.traceObjects.TraceCommandMap_map;
12+
import org.mvcexpress.core.traceObjects.TraceCommandMap_unmap;
913
import org.mvcexpress.mvc.Command;
1014
import org.mvcexpress.MvcExpress;
1115
import org.mvcexpress.utils.checkClassSuperclass;
@@ -49,7 +53,7 @@ public class CommandMap {
4953
// debug this action
5054
CONFIG::debug {
5155
if (MvcExpress.debugFunction != null) {
52-
MvcExpress.debugFunction("©©©+ CommandMap.map > type : " + type + ", commandClass : " + commandClass);
56+
MvcExpress.debugFunction(new TraceCommandMap_map("CommandMap.map", moduleName, type, commandClass));
5357
}
5458
validateCommandClass(commandClass);
5559
if (!Boolean(type) || type == "null" || type == "undefined") {
@@ -73,7 +77,7 @@ public class CommandMap {
7377
// debug this action
7478
CONFIG::debug {
7579
if (MvcExpress.debugFunction != null) {
76-
MvcExpress.debugFunction("©©©- CommandMap.unmap > type : " + type + ", commandClass : " + commandClass);
80+
MvcExpress.debugFunction(new TraceCommandMap_unmap("CommandMap.unmap", moduleName, type, commandClass));
7781
}
7882
}
7983
var commandList:Vector.<Class> = classRegistry[type];
@@ -109,10 +113,11 @@ public class CommandMap {
109113
// debug this action
110114
CONFIG::debug {
111115
if (MvcExpress.debugFunction != null) {
112-
MvcExpress.debugFunction("©* CommandMap.execute > commandClass : " + commandClass + ", params : " + params);
116+
MvcExpress.debugFunction(new TraceCommandMap_execute("CommandMap.execute", moduleName, command, commandClass, params));
117+
113118
}
114119
if (MvcExpress.loggerFunction != null) {
115-
MvcExpress.loggerFunction({action: "CommandMap.execute", moduleName: moduleName, commandObject: command, commandClass: commandClass, params: params});
120+
MvcExpress.loggerFunction(new TraceCommandMap_execute("CommandMap.execute", moduleName, command, commandClass, params));
116121
}
117122
validateCommandParams(commandClass, params);
118123
}
@@ -159,10 +164,10 @@ public class CommandMap {
159164
// debug this action
160165
CONFIG::debug {
161166
if (MvcExpress.debugFunction != null) {
162-
MvcExpress.debugFunction("©* CommandMap.handleCommandExecute > messageType : " + messageType + ", params : " + params + " Executed with : " + commandList[i]);
167+
MvcExpress.debugFunction(new TraceCommandMap_handleCommandExecute("CommandMap.handleCommandExecute", moduleName, command, commandList[i], messageType, params));
163168
}
164169
if (MvcExpress.loggerFunction != null) {
165-
MvcExpress.loggerFunction( { action: "CommandMap.handleCommandExecute", moduleName: moduleName, commandObject: command, commandClass: commandList[i], type:messageType, params: params } );
170+
MvcExpress.loggerFunction(new TraceCommandMap_handleCommandExecute("CommandMap.handleCommandExecute", moduleName, command, commandList[i], messageType, params));
166171
}
167172
}
168173

src/org/mvcexpress/core/MediatorMap.as

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import flash.utils.getQualifiedClassName;
66
import org.mvcexpress.core.interfaces.IMediatorMap;
77
import org.mvcexpress.core.messenger.Messenger;
88
import org.mvcexpress.core.namespace.pureLegsCore;
9+
import org.mvcexpress.core.traceObjects.TraceMediatorMap_map;
10+
import org.mvcexpress.core.traceObjects.TraceMediatorMap_mediate;
11+
import org.mvcexpress.core.traceObjects.TraceMediatorMap_unmap;
12+
import org.mvcexpress.core.traceObjects.TraceMediatorMap_unmediate;
913
import org.mvcexpress.mvc.Mediator;
1014
import org.mvcexpress.MvcExpress;
1115
import org.mvcexpress.utils.checkClassSuperclass;
@@ -44,7 +48,7 @@ public class MediatorMap implements IMediatorMap {
4448
// debug this action
4549
CONFIG::debug {
4650
if (MvcExpress.debugFunction != null) {
47-
MvcExpress.debugFunction("§§§+ MediatorMap.map > viewClass : " + viewClass + ", mediatorClass : " + mediatorClass);
51+
MvcExpress.debugFunction(new TraceMediatorMap_map("MediatorMap.map", moduleName, viewClass, mediatorClass));
4852
}
4953
// check if mediatorClass is subclass of Mediator class
5054
if (!checkClassSuperclass(mediatorClass, "org.mvcexpress.mvc::Mediator")) {
@@ -67,7 +71,7 @@ public class MediatorMap implements IMediatorMap {
6771
// debug this action
6872
CONFIG::debug {
6973
if (MvcExpress.debugFunction != null) {
70-
MvcExpress.debugFunction("§§§- MediatorMap.unmap > viewClass : " + viewClass);
74+
MvcExpress.debugFunction(new TraceMediatorMap_unmap("MediatorMap.unmap", moduleName, viewClass));
7175
}
7276
}
7377
// clear mapping
@@ -103,10 +107,10 @@ public class MediatorMap implements IMediatorMap {
103107
// debug this action
104108
CONFIG::debug {
105109
if (MvcExpress.debugFunction != null) {
106-
MvcExpress.debugFunction("§*+ MediatorMap.mediate > viewObject : " + viewObject + " (viewClass:" + viewClass + ")" + " WITH > mediatorClass : " + mediatorClass);
110+
MvcExpress.debugFunction(new TraceMediatorMap_mediate("MediatorMap.mediate", moduleName, viewObject, mediator, viewClass, mediatorClass, getQualifiedClassName(mediatorClass)));
107111
}
108112
if (MvcExpress.loggerFunction != null) {
109-
MvcExpress.loggerFunction({action: "MediatorMap.mediate", moduleName: moduleName, viewObject: viewObject, mediatorObject: mediator, viewClass: viewClass, mediatorClass: mediatorClass, mediatorClassName: getQualifiedClassName(mediatorClass)});
113+
MvcExpress.loggerFunction(new TraceMediatorMap_mediate("MediatorMap.mediate", moduleName, viewObject, mediator, viewClass, mediatorClass, getQualifiedClassName(mediatorClass)));
110114
}
111115
}
112116

@@ -138,10 +142,10 @@ public class MediatorMap implements IMediatorMap {
138142
// debug this action
139143
CONFIG::debug {
140144
if (MvcExpress.debugFunction != null) {
141-
MvcExpress.debugFunction("§*- MediatorMap.unmediate > viewObject : " + viewObject);
145+
MvcExpress.debugFunction(new TraceMediatorMap_unmediate("MediatorMap.unmediate", moduleName, viewObject));
142146
}
143147
if (MvcExpress.loggerFunction != null) {
144-
MvcExpress.loggerFunction({action: "MediatorMap.unmediate", moduleName: moduleName, viewObject: viewObject});
148+
MvcExpress.loggerFunction(new TraceMediatorMap_unmediate("MediatorMap.unmediate", moduleName, viewObject));
145149
}
146150
}
147151
// get object mediator

src/org/mvcexpress/core/ModuleBase.as

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.mvcexpress.core.messenger.Messenger;
88
import org.mvcexpress.core.ModuleManager;
99
import org.mvcexpress.core.namespace.pureLegsCore;
1010
import org.mvcexpress.core.ProxyMap;
11+
import org.mvcexpress.core.traceObjects.TraceModuleBase_sendMessage;
1112
import org.mvcexpress.MvcExpress;
1213

1314
/**
@@ -134,7 +135,7 @@ public class ModuleBase {
134135
// log the action
135136
CONFIG::debug {
136137
if (MvcExpress.loggerFunction != null) {
137-
MvcExpress.loggerFunction({action: "ModuleBase.sendMessage", moduleObject: this, type: type, params: params});
138+
MvcExpress.loggerFunction(new TraceModuleBase_sendMessage("ModuleBase.sendMessage", moduleName, this, type, params));
138139
}
139140
}
140141
//
@@ -143,7 +144,7 @@ public class ModuleBase {
143144
// clean up loging the action
144145
CONFIG::debug {
145146
if (MvcExpress.loggerFunction != null) {
146-
MvcExpress.loggerFunction({action: "ModuleBase.sendMessage.CLEAN", moduleObject: this, type: type, params: params});
147+
MvcExpress.loggerFunction(new TraceModuleBase_sendMessage("ModuleBase.sendMessage.CLEAN", moduleName, this, type, params));
147148
}
148149
}
149150

src/org/mvcexpress/core/ProxyMap.as

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import org.mvcexpress.core.inject.InjectRuleVO;
77
import org.mvcexpress.core.interfaces.IProxyMap;
88
import org.mvcexpress.core.messenger.Messenger;
99
import org.mvcexpress.core.namespace.pureLegsCore;
10+
import org.mvcexpress.core.traceObjects.TraceProxyMap_injectPending;
11+
import org.mvcexpress.core.traceObjects.TraceProxyMap_injectStuff;
12+
import org.mvcexpress.core.traceObjects.TraceProxyMap_map;
13+
import org.mvcexpress.core.traceObjects.TraceProxyMap_unmap;
1014
import org.mvcexpress.mvc.Command;
1115
import org.mvcexpress.mvc.Mediator;
1216
import org.mvcexpress.mvc.Proxy;
@@ -60,10 +64,10 @@ public class ProxyMap implements IProxyMap {
6064
// debug this action
6165
CONFIG::debug {
6266
if (MvcExpress.debugFunction != null) {
63-
MvcExpress.debugFunction("¶¶¶+ ProxyMap.map > proxyObject : " + proxyObject + ", injectClass : " + injectClass + ", name : " + name);
67+
MvcExpress.debugFunction(new TraceProxyMap_map("ProxyMap.map", moduleName, proxyObject, injectClass, name));
6468
}
6569
if (MvcExpress.loggerFunction != null) {
66-
MvcExpress.loggerFunction({action: "ProxyMap.map", moduleName: moduleName, proxyObject: proxyObject, injectClass: injectClass, name: name});
70+
MvcExpress.loggerFunction(new TraceProxyMap_map("ProxyMap.map", moduleName, proxyObject, injectClass, name));
6771
}
6872
}
6973

@@ -107,10 +111,10 @@ public class ProxyMap implements IProxyMap {
107111
// debug this action
108112
CONFIG::debug {
109113
if (MvcExpress.debugFunction != null) {
110-
MvcExpress.debugFunction("¶¶¶¶- ProxyMap.unmap > injectClass : " + injectClass + ", name : " + name);
114+
MvcExpress.debugFunction(new TraceProxyMap_unmap("ProxyMap.unmap", moduleName, injectClass, name));
111115
}
112116
if (MvcExpress.loggerFunction != null) {
113-
MvcExpress.loggerFunction({action: "ProxyMap.unmap", moduleName: moduleName, injectClass: injectClass, name: name});
117+
MvcExpress.loggerFunction(new TraceProxyMap_unmap("ProxyMap.unmap", moduleName, injectClass, name));
114118
}
115119
}
116120
// remove proxy if it exists.
@@ -202,7 +206,7 @@ public class ProxyMap implements IProxyMap {
202206
// debug this action
203207
CONFIG::debug {
204208
if (MvcExpress.loggerFunction != null) {
205-
MvcExpress.loggerFunction({action: "ProxyMap.injectStuff", moduleName: moduleName, hostObject: object, injectObject: injectObject, rule: rules[i]});
209+
MvcExpress.loggerFunction(new TraceProxyMap_injectStuff("ProxyMap.injectStuff", moduleName, object, injectObject, rules[i]));
206210
}
207211
}
208212
} else {
@@ -217,8 +221,7 @@ public class ProxyMap implements IProxyMap {
217221
// debug this action
218222
CONFIG::debug {
219223
if (MvcExpress.debugFunction != null) {
220-
// TODO: add option to ignore this warning.
221-
MvcExpress.debugFunction("WARNING: Pending injection. Inject object is not found for class with id:" + rules[i].injectClassAndName + "(needed in " + object + ")");
224+
MvcExpress.debugFunction(new TraceProxyMap_injectPending("ProxyMap.injectPending", moduleName, object, injectObject, rules[i]));
222225
}
223226
}
224227
//

src/org/mvcexpress/core/messenger/Messenger.as

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import flash.utils.Dictionary;
44
import org.mvcexpress.core.CommandMap;
55
import org.mvcexpress.core.ModuleManager;
66
import org.mvcexpress.core.namespace.pureLegsCore;
7+
import org.mvcexpress.core.traceObjects.TraceMessenger_addHandler;
8+
import org.mvcexpress.core.traceObjects.TraceMessenger_removeHandler;
9+
import org.mvcexpress.core.traceObjects.TraceMessenger_send;
10+
import org.mvcexpress.core.traceObjects.TraceMessenger_send_handler;
11+
import org.mvcexpress.core.traceObjects.TraceMessenger_sendToAll;
712
import org.mvcexpress.MvcExpress;
813

914
/**
@@ -43,10 +48,12 @@ public class Messenger {
4348
* @return returns message data object. This object can be disabled instead of removing the handle with function. (disabling is much faster)
4449
*/
4550
public function addHandler(type:String, handler:Function, handlerClassName:String = null):HandlerVO {
51+
trace("Messenger.addHandler > type : " + type + ", handler : " + handler + ", handlerClassName : " + handlerClassName);
4652
// debug this action
4753
CONFIG::debug {
4854
if (MvcExpress.debugFunction != null) {
49-
MvcExpress.debugFunction("••<+ Messenger.addHandler > type : " + type + ", handler : " + handler + ", handlerClassName : " + handlerClassName);
55+
use namespace pureLegsCore;
56+
MvcExpress.debugFunction(new TraceMessenger_addHandler("Messenger.addHandler", moduleName, type, handler, handlerClassName));
5057
}
5158
}
5259

@@ -87,7 +94,8 @@ public class Messenger {
8794
// debug this action
8895
CONFIG::debug {
8996
if (MvcExpress.debugFunction != null) {
90-
MvcExpress.debugFunction("••<- Messenger.removeHandler > type : " + type + ", handler : " + handler);
97+
use namespace pureLegsCore;
98+
MvcExpress.debugFunction(new TraceMessenger_removeHandler("Messenger.removeHandler", moduleName, type, handler));
9199
}
92100
}
93101
if (handlerRegistry[type]) {
@@ -109,10 +117,10 @@ public class Messenger {
109117
// debug this action
110118
CONFIG::debug {
111119
if (MvcExpress.debugFunction != null) {
112-
MvcExpress.debugFunction("•> Messenger.send > type : " + type + ", params : " + params);
120+
MvcExpress.debugFunction(new TraceMessenger_send("Messenger.send", moduleName, type, params));
113121
}
114122
if (MvcExpress.loggerFunction != null) {
115-
MvcExpress.loggerFunction({action: "Messenger.send", moduleName: moduleName, type: type, params: params});
123+
MvcExpress.loggerFunction(new TraceMessenger_send("Messenger.send", moduleName, type, params));
116124
}
117125
}
118126
var messageList:Vector.<HandlerVO> = messageRegistry[type];
@@ -144,7 +152,7 @@ public class Messenger {
144152
handlerVo.handlerClassName
145153
//
146154
if (MvcExpress.loggerFunction != null) {
147-
MvcExpress.loggerFunction({action: "Messenger.send.HANDLER", moduleName: moduleName, type: type, params: params, handler: handlerVo.handler, handlerClassName: handlerVo.handlerClassName});
155+
MvcExpress.loggerFunction(new TraceMessenger_send_handler("Messenger.send.HANDLER", moduleName, type, params, handlerVo.handler, handlerVo.handlerClassName));
148156
}
149157
}
150158
handlerVo.handler(params);
@@ -170,7 +178,8 @@ public class Messenger {
170178
throw Error("sendMessageToAll feature is disabled by MvcExpress.disableSendToAllFeature set to true.");
171179
}
172180
if (MvcExpress.debugFunction != null) {
173-
MvcExpress.debugFunction("•>>> Messenger.sendToAll > type : " + type + ", params : " + params);
181+
MvcExpress.debugFunction(new TraceMessenger_sendToAll("Messenger.sendToAll", moduleName, type, params))
182+
174183
}
175184
}
176185
use namespace pureLegsCore;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.mvcexpress.core.traceObjects {
2+
import flash.display.DisplayObject;
3+
import org.mvcexpress.core.ModuleBase;
4+
import org.mvcexpress.mvc.Command;
5+
import org.mvcexpress.mvc.Mediator;
6+
import org.mvcexpress.mvc.Proxy;
7+
8+
/**
9+
* COMMENT
10+
* @author Raimundas Banevicius (http://www.mindscriptact.com/)
11+
*/
12+
public class TraceCommandMap_execute extends TraceObj {
13+
14+
public var commandObject:Command;
15+
public var commandClass:Class;
16+
public var params:Object;
17+
18+
public var view:DisplayObject;
19+
20+
public var messageFromModule:ModuleBase;
21+
public var messageFromMediator:Mediator;
22+
public var messageFromProxy:Proxy;
23+
public var messageFromCommand:Command;
24+
25+
public function TraceCommandMap_execute(action:String, moduleName:String, commandObject:Command, commandClass:Class, params:Object) {
26+
super(action, moduleName);
27+
this.commandObject = commandObject;
28+
this.commandClass = commandClass;
29+
this.params = params;
30+
}
31+
32+
override public function toString():String {
33+
return "©* CommandMap.execute > commandClass : " + commandClass + ", params : " + params;
34+
}
35+
36+
}
37+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package org.mvcexpress.core.traceObjects {
2+
import flash.display.DisplayObject;
3+
import org.mvcexpress.core.ModuleBase;
4+
import org.mvcexpress.mvc.Command;
5+
import org.mvcexpress.mvc.Mediator;
6+
import org.mvcexpress.mvc.Proxy;
7+
8+
/**
9+
* COMMENT
10+
* @author Raimundas Banevicius (http://www.mindscriptact.com/)
11+
*/
12+
public class TraceCommandMap_handleCommandExecute extends TraceObj {
13+
14+
public var commandObject:Command;
15+
public var commandClass:Class;
16+
public var type:String;
17+
public var params:Object;
18+
19+
public var view:DisplayObject;
20+
21+
public var messageFromModule:ModuleBase;
22+
public var messageFromMediator:Mediator;
23+
public var messageFromProxy:Proxy;
24+
public var messageFromCommand:Command;
25+
26+
public function TraceCommandMap_handleCommandExecute(action:String, moduleName:String, commandObject:Command, commandClass:Class, type:String, params:Object) {
27+
super(action, moduleName);
28+
this.commandObject = commandObject;
29+
this.commandClass = commandClass;
30+
this.type = type;
31+
this.params = params;
32+
}
33+
34+
override public function toString():String {
35+
return "©* CommandMap.handleCommandExecute > messageType : " + type + ", params : " + params + " Executed with : " + commandClass;
36+
}
37+
38+
}
39+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.mvcexpress.core.traceObjects {
2+
3+
/**
4+
* COMMENT
5+
* @author Raimundas Banevicius (http://www.mindscriptact.com/)
6+
*/
7+
public class TraceCommandMap_map extends TraceObj {
8+
9+
public var type:String;
10+
public var commandClass:Class;
11+
12+
public function TraceCommandMap_map(action:String, moduleName:String, type:String, commandClass:Class) {
13+
super(action, moduleName);
14+
this.type = type;
15+
this.commandClass = commandClass;
16+
}
17+
18+
override public function toString():String {
19+
return "©©©+ CommandMap.map > type : " + type + ", commandClass : " + commandClass;
20+
}
21+
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.mvcexpress.core.traceObjects {
2+
3+
/**
4+
* COMMENT
5+
* @author Raimundas Banevicius (http://www.mindscriptact.com/)
6+
*/
7+
public class TraceCommandMap_unmap extends TraceObj {
8+
9+
public var type:String;
10+
public var commandClass:Class;
11+
12+
public function TraceCommandMap_unmap(action:String, moduleName:String, type:String, commandClass:Class) {
13+
super(action, moduleName);
14+
this.type = type;
15+
this.commandClass = commandClass;
16+
}
17+
18+
override public function toString():String {
19+
return "©©©- CommandMap.unmap > type : " + type + ", commandClass : " + commandClass;
20+
}
21+
22+
}
23+
}

0 commit comments

Comments
 (0)