You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Ian Clelland <ic...@chromium.org> on 2013/05/06 16:42:40 UTC

Logger plugin and console

Prompted by CB-3327, I've been looking again at the implementation of the
Logger plugin and how it interacts with the native JS console object.

>From what I can see, the current situation is this:

* We have a Logger plugin, which will *either* log using native code, or
using the console object, depending on the state of logger.useConsole. It
will not do both.

* We also have a console-via-logger plugin, which will log using the
console object, or using *both* JS console and the Logger plugin, depending
on console.useLogger.

* If console.useLogger and logger.useConsole are *both* true, then errors
are thrown all around.

* Also, console-via-logger appears to be unused, because it is never mapped
to console. (No calls to moduleMapper reference that plugin, and there are
no references to it anywhere in cordova-js/lib). I suspect that it is never
used at all.

(There used to be a *third* iOS-only DebugConsole plugin, but I removed
that about a month ago)

This is a mess.

At this point, unless anyone objects, I intend to simplify things greatly
by allowing the Logger plugin to log to *both* the JS console and native
code. console-via-logger can then be removed, or made into a no-op, as
required.

Ian

Re: Logger plugin and console

Posted by Shazron <sh...@gmail.com>.
+1 Sounds reasonable to me


On Mon, May 6, 2013 at 7:42 AM, Ian Clelland <ic...@chromium.org> wrote:

> Prompted by CB-3327, I've been looking again at the implementation of the
> Logger plugin and how it interacts with the native JS console object.
>
> From what I can see, the current situation is this:
>
> * We have a Logger plugin, which will *either* log using native code, or
> using the console object, depending on the state of logger.useConsole. It
> will not do both.
>
> * We also have a console-via-logger plugin, which will log using the
> console object, or using *both* JS console and the Logger plugin, depending
> on console.useLogger.
>
> * If console.useLogger and logger.useConsole are *both* true, then errors
> are thrown all around.
>
> * Also, console-via-logger appears to be unused, because it is never mapped
> to console. (No calls to moduleMapper reference that plugin, and there are
> no references to it anywhere in cordova-js/lib). I suspect that it is never
> used at all.
>
> (There used to be a *third* iOS-only DebugConsole plugin, but I removed
> that about a month ago)
>
> This is a mess.
>
> At this point, unless anyone objects, I intend to simplify things greatly
> by allowing the Logger plugin to log to *both* the JS console and native
> code. console-via-logger can then be removed, or made into a no-op, as
> required.
>
> Ian
>

Re: Logger plugin and console

Posted by Ian Clelland <ic...@google.com>.
I've fixed Logger; if I don't notice any additional issues, I'll push
another change to delete the unused console-via-logger plugin as well.


On Mon, May 6, 2013 at 2:56 PM, Braden Shepherdson <br...@chromium.org>wrote:

> +1 I didn't know it was that confused.
>
>
> On Mon, May 6, 2013 at 11:51 AM, Anis KADRI <an...@gmail.com> wrote:
>
> > On Mon, May 6, 2013 at 7:42 AM, Ian Clelland <ic...@chromium.org>
> > wrote:
> >
> > > * If console.useLogger and logger.useConsole are *both* true, then
> errors
> > > are thrown all around.
> > >
> >
> > This is especially not good.
> >
> > +1 on cleaning things up.
> >
>

Re: Logger plugin and console

Posted by Braden Shepherdson <br...@chromium.org>.
+1 I didn't know it was that confused.


On Mon, May 6, 2013 at 11:51 AM, Anis KADRI <an...@gmail.com> wrote:

> On Mon, May 6, 2013 at 7:42 AM, Ian Clelland <ic...@chromium.org>
> wrote:
>
> > * If console.useLogger and logger.useConsole are *both* true, then errors
> > are thrown all around.
> >
>
> This is especially not good.
>
> +1 on cleaning things up.
>

Re: Logger plugin and console

Posted by Anis KADRI <an...@gmail.com>.
On Mon, May 6, 2013 at 7:42 AM, Ian Clelland <ic...@chromium.org> wrote:

> * If console.useLogger and logger.useConsole are *both* true, then errors
> are thrown all around.
>

This is especially not good.

+1 on cleaning things up.