incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject git commit: Fixes CB-516 - undefined variable maxDepth in nested console.log (iOS only)
Date Sun, 15 Apr 2012 23:54:14 GMT
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 <shazron@gmail.com>
Authored: Sun Apr 15 16:54:05 2012 -0700
Committer: Shazron Abdullah <shazron@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) {


Mime
View raw message