You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/04/16 01:54:14 UTC
git commit: Fixes CB-516 - undefined variable maxDepth in nested
console.log (iOS only)
Updated Branches:
refs/heads/master 38cd78f57 -> 2de1d613e
Fixes CB-516 - undefined variable maxDepth in nested console.log (iOS only)
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/2de1d613
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/2de1d613
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/2de1d613
Branch: refs/heads/master
Commit: 2de1d613e433ca41e9a468b9e79512c203cbaa76
Parents: 38cd78f
Author: Shazron Abdullah <sh...@gmail.com>
Authored: Sun Apr 15 16:54:05 2012 -0700
Committer: Shazron Abdullah <sh...@gmail.com>
Committed: Sun Apr 15 16:54:05 2012 -0700
----------------------------------------------------------------------
lib/ios/plugin/ios/console.js | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2de1d613/lib/ios/plugin/ios/console.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/console.js b/lib/ios/plugin/ios/console.js
index 8651591..278dfbb 100644
--- a/lib/ios/plugin/ios/console.js
+++ b/lib/ios/plugin/ios/console.js
@@ -9,13 +9,15 @@ function indent(str) {
/**
* Format a string for pretty logging
*/
-function makeStructured(obj, depth) {
+function makeStructured(obj, maxDepth, depth) {
var str = "";
+ depth = depth || 0;
+
for (var i in obj) {
try {
- if (typeof(obj[i]) == 'object' && depth < maxDepth) {
- str += i + ":\n" + indent(makeStructured(obj[i])) + "\n";
- } else {
+ if (typeof(obj[i]) == 'object' && maxDepth && depth < maxDepth) {
+ str += i + ":\n" + indent(makeStructured(obj[i], maxDepth, depth+1)) + "\n";
+ } else {
str += i + " = " + indent(String(obj[i])).replace(/^ {4}/, "") + "\n";
}
} catch(e) {