debugConsole.html 1.42 KB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	"http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>testing debugging and logging functions</title>
		<script type="text/javascript">
			djConfig = {};
			djConfig.isDebug = document.location.href.match(/\?ON/);
		</script>
		<script type="text/javascript" src="../../../dojo.js"></script>
		<script type="text/javascript">
			dojo.addOnLoad(function(){
				var toggle = document.getElementById("toggle").innerHTML = djConfig.isDebug?"ON":"OFF";
			});
			
			var aString = "this is my test string";
			var anObject = {
				aProperty: "aValue",
				anotherProperty: "anotherValue",
				aNumber: 1234
			};
			
			var cn = ["debug","log",
				"assert", "count", "dir", "dirxml", "error", "group",
				"groupEnd", "info", "profile", "profileEnd", "time", "timeEnd",
				"trace", "warn"
			];
			for(var i=0;i<cn.length;i++) {
				console[cn[i]]( cn[i] + ": " + aString);
				console[cn[i]]( cn[i] + ": " + anObject);
			}
		</script>
	</head>
	<body>
		<p>
			Testing console.* methods with djConfig.isDebug turned <span id="toggle"></span>
		</p>
		<p>
			Append '?ON' to URL to try with djConfig.isDebug turned ON. Remove it to test djConfig.isDebug turned OFF
		</p>
		<p>
			If isDebug is off (false), then make sure console functions go to a simple empty function. You may see 
			errors in the console, since console.error is being tested as part of this test.
		</p>
	</body>
</html>