You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/03/20 16:49:02 UTC
[18/40] js commit: Fixed CB-2620: console.log prints only the first
argument on Xcode console
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/cb2227
Commit: d53601e5486f888c60194b56e039863a0da61da1
Parents: 6049d66
Author: cnandreu <cn...@gmail.com>
Authored: Tue Mar 5 00:30:11 2013 -0600
Committer: Andrew Grieve <ag...@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;