console.group is not working

40 views
Skip to first unread message

megg

unread,
Nov 23, 2017, 3:08:25 AM11/23/17
to weinre
Hi,
my app is using console.group and weinre doesn't log any of them. is there any workarround for that

Patrick Mueller

unread,
Nov 23, 2017, 8:43:14 PM11/23/17
to weinre
First off, you might not need to use weinre, as there may be a better debugger you can use.  See the info in the yellow box, here: https://people.apache.org/~pmuellr/weinre/docs/latest/

The `console` "group" functions according to https://developer.mozilla.org/en-US/docs/Web/API/Console are:

- group()
- groupCollapsed()
- groupEnd()

If they aren't currently supported in weinre, they won't ever be, likely, since I no longer develop weinre.

Seems like the best workaround would be to just create no-op versions of them if they don't already exist, somewhere near the beginning of your code.

Eg,

if (console.group == null) {
   var noopFunction = function () {}
   console.group = noopFunction
   console.groupCollapsed = noopFunction
   console.groupEnd = noopFunction
Reply all
Reply to author
Forward
0 new messages