cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject js commit: Fixed CB-2620: console.log prints only the first argument on Xcode console
Date Tue, 05 Mar 2013 19:36:03 GMT
Updated Branches:
  refs/heads/master 6049d6674 -> d53601e54


Fixed CB-2620: console.log prints only the first argument on Xcode console


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/d53601e5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/d53601e5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/d53601e5

Branch: refs/heads/master
Commit: d53601e5486f888c60194b56e039863a0da61da1
Parents: 6049d66
Author: cnandreu <cnandreu@gmail.com>
Authored: Tue Mar 5 00:30:11 2013 -0600
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Mar 5 11:22:33 2013 -0800

----------------------------------------------------------------------
 lib/ios/plugin/ios/console.js |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d53601e5/lib/ios/plugin/ios/console.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/console.js b/lib/ios/plugin/ios/console.js
index b07c213..82ff059 100644
--- a/lib/ios/plugin/ios/console.js
+++ b/lib/ios/plugin/ios/console.js
@@ -34,7 +34,7 @@ function stringify(message) {
                 return "error JSON.stringify()ing argument: " + e;
             }
         } else {
-            return message.toString();
+            return (typeof message === "undefined") ? "undefined" : message.toString();
         }
     } catch (e) {
         return e.toString();
@@ -48,10 +48,20 @@ function stringify(message) {
 function wrappedMethod(console, method) {
     var origMethod = console[method];
 
-    return function(message) {
+    return function() {
+
+        var args = [].slice.call(arguments),
+            len = args.length,
+            i = 0,
+            res = [];
+
+        for ( ; i < len; i++) {
+            res.push(stringify(args[i]));
+        }
+
         exec(null, null,
             'Debug Console', 'log',
-            [ stringify(message), { logLevel: method.toUpperCase() } ]
+            [ res.join(' '), { logLevel: method.toUpperCase() } ]
         );
 
         if (!origMethod) return;


Mime
View raw message