incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Mueller (JIRA)" <>
Subject [jira] [Commented] (CB-348) console object improvements
Date Wed, 23 May 2012 14:42:41 GMT


Patrick Mueller commented on CB-348:

The current implementation of this issue is the {{lib/common/plugin/console-via-logger.js}}
file, which is only useful if you are also using the logger plugin as the sink of the logging

We can do better, to provide a way for folks with lame-y {{console}} objects to be shimmed.
 Shimming means adding the methods in the FireBug/node.js {{console}} objects [1][2].

Basic idea is to create a new module {{console-shims.js}}, which will support the following

Will create missing {{console}} methods which all use {{console.log()}} to generate the output.

Calls {{removeShims()}} before installing the shims.

Will create missing {{console}} methods which all use {{console.log()}} to generate the output,
and for existing {{console}} methods, will call the original and then a 'shimmed' version
which calls console.log()

Calls {{removeShims()}} before installing the shims.

Resets the {{console}} object to the original version.

Sets {{console.log()}} to call the original {{console.log()}}, if it exists, then logs the
message with {{logger.log()}}

For all platforms, we'll use:

For iOS, we'll use:

And then of course other platforms can do whatever they wish.

We can then do away with {{console-via-logger.js}}.

> console object improvements
> ---------------------------
>                 Key: CB-348
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: CordovaJS
>            Reporter: Patrick Mueller
>            Assignee: Patrick Mueller
> There is some room for improvement in the console object we support in Cordova.
> # not all of the common API is supported.  Here is the API as implemented by Firebug,
most of which is also implemented in Web Inspector: [Firebug Console API|].
 An example of the issue with this is that the weinre demo makes use of markTimeline (actually,
that's a WebKit-only console method - I think the only one!).  So the demo dies an early death,
if Cordova's console wins the "overwrite the native" battle.
> \\ \\
> # which naturally leads to the next issue - the console should daisy chain its calls
to the "native" console, if it exists.  An example of this issue is that if you use iWebInspector
on a Cordova app, console logging happens in the Xcode console, not the iWebInspector console.
 I'm fine to have it in both places.
> \\ \\
> # console output operations should "buffer".  An example of this issue is that any console
operations which occur BEFORE deviceReady are passed directly to the bit bucket.  Instead,
we should "buffer" these, and then when deviceReady occurs, the console can dump what it's
> Turns out, I have some of these same issues in weinre, but I don't think we can share
an implementation.  weinre generally just delegates everything to the weinre client - eg,
arguments to console.log() are sent as 'remote objects', whereas in Cordova we actually need
to evaluate them.  The buffering and daisy chaining should be exactly the same, and perhaps
those need to be configured (eg, console.daisyChainNative(false)) - maybe the code or at least
design could be shared there.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message