Download

Concepts

Example

Documentation

Plugins

How to

Contribute

Links

Trace

What is this ?

The Trace class is the clas that will help you with debug. This is a static class.

How do I debug ?

If you want to debug, the first thing you have to do is to change your framework configuration file and set debug to true and choose you debugWay.

If you are using Firefox and you wish to use the console debug, you should install Firebug.

<?xml version="1.0" encoding="utf-8"?>
<items>
	<framework>
		<item version="1.0.7" />
		...
		<debug>
			<item debugWay="console" />
			<item debug="true" />
			<item debugFwk="true" />
			<item debugBinding="false" />
			<item debugLaunchMethod="false" />
			<item showTiming="true" />
		</debug>
		...
	</framework>
	...
</items>		
		

Then you can call debug methods :

var ModuleModel = Class.create(ModelHelper, {
	...	
	init: function($super) {
		$super();
  		trace("I'm initializing");
	},
	...
	errorHandler: function() {
		Trace.writeError('errorHandler');
	}
});

Let's see a view from the initialization of the framework

Firebug-init-framework_medium

How do I use firebug in browser different from Firefox ?

The answer is firebug lite. You just have to insert the firebug script in the head part of your HTML before the framework.

<head>
	...
	<script type="text/javascript" src="http://localhost/js/WZFwk/libs/firebug/1.23.js"></script>
	
	<script type="text/javascript" src="http://localhost/js/WZFwk/libs/prototype/1.6.0.3.js"></script>
	<script type="text/javascript" src="http://localhost/js/WZFwk/libs/prototype/extends.js"></script>
	<script type="text/javascript" src="http://localhost/js/WZFwk/compress/compress.js"></script>
	<script type="text/javascript">
		var initializer = new Initializer();
		initializer.init("http://localhost/js/application/conf.xml");
	</script>
	...
</head>

Then you can use the debug methods as if you were on Firefox.

Global method

trace(str)

The trace method is really convenient, it is a proxy to the method Trace.writeMessage().

Trace methods

writeMessage(str)

Will trace in the console the message str.

writeWarning(str)

Will trace in the console the warning message str.

writeError(str)

Will trace in the console the error message str.