You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Jeffrey Knight (JIRA)" <ji...@apache.org> on 2012/10/04 17:25:47 UTC

[jira] [Created] (CB-1585) console.debug, console.info are undefined

Jeffrey Knight created CB-1585:
----------------------------------

             Summary: console.debug, console.info are undefined
                 Key: CB-1585
                 URL: https://issues.apache.org/jira/browse/CB-1585
             Project: Apache Cordova
          Issue Type: Bug
          Components: CordovaJS
    Affects Versions: 2.1.0
         Environment: phonegap-phonegap-2.1.0-0-g26d211b.zip
            Reporter: Jeffrey Knight
            Assignee: Filip Maj
            Priority: Critical


cordova-2.1.0.js 

Issue: Web app works as expected in browser. Firebug shows console.debug + console.info messages. Drop app into phonegap and it does not work.
 
Cause: console.debug/info are not defined.

Fix: add debug+info protypes to console:
https://github.com/jknight/incubator-cordova-js/blob/patch-1/lib/ios/plugin/ios/console.js



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CB-1585) console.debug, console.info are undefined

Posted by "Patrick Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13469590#comment-13469590 ] 

Patrick Mueller commented on CB-1585:
-------------------------------------

Here's a better view of the patch:

https://github.com/jknight/incubator-cordova-js/compare/47fce02062301efaf3f5b0cc55f68ef1d1a22c06...patch-1

Coupla things:

- the wording in a couple of places references warn()/debug(), but I think this bug correctly identifies the missing methods as info()/debug(), as we already have log(), warn() and error().  Correct?

- mucking with the DebugConsole.xxx_LEVEL constants would really require changing the natives as well, and I don't think there is any functional reason to do so.  This particular module has more function than most of the
consoles out there - eg, setLevel(), which I think we want to drop, because no one needs it.  There's another bug out there regarding using a superset of Firebug/WebKit/node "console" methods, which is a better, more portable solution.

So, easiest way to do this is to just add some new origConsole_XXX vars here: 

    https://github.com/apache/incubator-cordova-js/blob/0e58060f07209c44b084fbde5b305768c05a511f/lib/ios/plugin/ios/console.js#L68

and then create new DebugConsole.prototype.XXX methods here: 

    https://github.com/apache/incubator-cordova-js/blob/0e58060f07209c44b084fbde5b305768c05a511f/lib/ios/plugin/ios/console.js#L101

and have those implementations call the original versions, then DebugConsole.prototype.log() .

I can do this, or you can.  If you want to, I'd want a pull request at the end, and to have you get a signed CLA on file - SEE FIRST ITEM ON THIS WIKI PAGE - http://wiki.apache.org/cordova/ContributorWorkflow .


                
> console.debug, console.info are undefined
> -----------------------------------------
>
>                 Key: CB-1585
>                 URL: https://issues.apache.org/jira/browse/CB-1585
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 2.1.0
>         Environment: phonegap-phonegap-2.1.0-0-g26d211b.zip
>            Reporter: Jeffrey Knight
>            Assignee: Filip Maj
>            Priority: Critical
>              Labels: javascript
>
> cordova-2.1.0.js 
> Issue: Web app works as expected in browser. Firebug shows console.debug + console.info messages. Drop app into phonegap and it does not work.
>  
> Cause: console.debug/info are not defined.
> Fix: add debug+info protypes to console:
> https://github.com/jknight/incubator-cordova-js/blob/patch-1/lib/ios/plugin/ios/console.js

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CB-1585) console.debug, console.info are undefined

Posted by "Patrick Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13470199#comment-13470199 ] 

Patrick Mueller commented on CB-1585:
-------------------------------------

Realized there are a few other problems with good ol' DebugConsole:

- the setLevel() stuff isn't really usable, since the constants aren't easily accessible anywhere.  (maybe in console.constructor or something)

- with real Web Inspector capabilities now, turns out we're removing all that functionality from the user; we need a different story to allow all the new existing methods to run correctly

Fix is a bit more elaborate, working on it now.
                
> console.debug, console.info are undefined
> -----------------------------------------
>
>                 Key: CB-1585
>                 URL: https://issues.apache.org/jira/browse/CB-1585
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 2.1.0
>         Environment: phonegap-phonegap-2.1.0-0-g26d211b.zip
>            Reporter: Jeffrey Knight
>            Assignee: Patrick Mueller
>            Priority: Critical
>              Labels: javascript
>
> cordova-2.1.0.js 
> Issue: Web app works as expected in browser. Firebug shows console.debug + console.info messages. Drop app into phonegap and it does not work.
>  
> Cause: console.debug/info are not defined.
> Fix: add debug+info protypes to console:
> https://github.com/jknight/incubator-cordova-js/blob/patch-1/lib/ios/plugin/ios/console.js

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CB-1585) console.debug, console.info are undefined

Posted by "Patrick Mueller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Mueller updated CB-1585:
--------------------------------

    Assignee: Patrick Mueller  (was: Filip Maj)
    
> console.debug, console.info are undefined
> -----------------------------------------
>
>                 Key: CB-1585
>                 URL: https://issues.apache.org/jira/browse/CB-1585
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 2.1.0
>         Environment: phonegap-phonegap-2.1.0-0-g26d211b.zip
>            Reporter: Jeffrey Knight
>            Assignee: Patrick Mueller
>            Priority: Critical
>              Labels: javascript
>
> cordova-2.1.0.js 
> Issue: Web app works as expected in browser. Firebug shows console.debug + console.info messages. Drop app into phonegap and it does not work.
>  
> Cause: console.debug/info are not defined.
> Fix: add debug+info protypes to console:
> https://github.com/jknight/incubator-cordova-js/blob/patch-1/lib/ios/plugin/ios/console.js

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CB-1585) console.debug, console.info are undefined

Posted by "Jesse MacFadyen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13470574#comment-13470574 ] 

Jesse MacFadyen commented on CB-1585:
-------------------------------------

On Windows8 and WP7 I do this :

{code:javascript}
if(!console || !console.log) {
    var exec = require('cordova/exec');

    var debugConsole = {
        log:function(msg){
            exec(null,null,"DebugConsole","log",msg);
        },
        warn:function(msg){
            exec(null,null,"DebugConsole","warn",msg);
        },
        error:function(msg){
            exec(null,null,"DebugConsole","error",msg);
        }
    };

    module.exports = debugConsole;
}
else if(console && console.log) {

  console.log("console.log exists already!");
  console.warn = console.warn || function(msg){console.log("warn:"+msg);};
  console.error = console.error || function(msg){console.log("error:"+msg);};
}
{code}

This could probably be used elsewherz.


                
> console.debug, console.info are undefined
> -----------------------------------------
>
>                 Key: CB-1585
>                 URL: https://issues.apache.org/jira/browse/CB-1585
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 2.1.0
>         Environment: phonegap-phonegap-2.1.0-0-g26d211b.zip
>            Reporter: Jeffrey Knight
>            Assignee: Patrick Mueller
>            Priority: Critical
>              Labels: javascript
>
> cordova-2.1.0.js 
> Issue: Web app works as expected in browser. Firebug shows console.debug + console.info messages. Drop app into phonegap and it does not work.
>  
> Cause: console.debug/info are not defined.
> Fix: add debug+info protypes to console:
> https://github.com/jknight/incubator-cordova-js/blob/patch-1/lib/ios/plugin/ios/console.js

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CB-1585) console.debug, console.info are undefined

Posted by "Patrick Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13471658#comment-13471658 ] 

Patrick Mueller commented on CB-1585:
-------------------------------------

I took a cue from Jesse and greatly simplified the iOS console, by monkey patching the original console, only creating a new console object if there wasn't one already (which I don't think will ever happen on iOS).

In commit:

https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commit;h=2033fdc37d23b5aea724accc574eed7587aa9a6c
                
> console.debug, console.info are undefined
> -----------------------------------------
>
>                 Key: CB-1585
>                 URL: https://issues.apache.org/jira/browse/CB-1585
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 2.1.0
>         Environment: phonegap-phonegap-2.1.0-0-g26d211b.zip
>            Reporter: Jeffrey Knight
>            Assignee: Patrick Mueller
>            Priority: Critical
>              Labels: javascript
>             Fix For: 2.2.0
>
>
> cordova-2.1.0.js 
> Issue: Web app works as expected in browser. Firebug shows console.debug + console.info messages. Drop app into phonegap and it does not work.
>  
> Cause: console.debug/info are not defined.
> Fix: add debug+info protypes to console:
> https://github.com/jknight/incubator-cordova-js/blob/patch-1/lib/ios/plugin/ios/console.js

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CB-1585) console.debug, console.info are undefined

Posted by "Patrick Mueller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Mueller resolved CB-1585.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.0
    
> console.debug, console.info are undefined
> -----------------------------------------
>
>                 Key: CB-1585
>                 URL: https://issues.apache.org/jira/browse/CB-1585
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 2.1.0
>         Environment: phonegap-phonegap-2.1.0-0-g26d211b.zip
>            Reporter: Jeffrey Knight
>            Assignee: Patrick Mueller
>            Priority: Critical
>              Labels: javascript
>             Fix For: 2.2.0
>
>
> cordova-2.1.0.js 
> Issue: Web app works as expected in browser. Firebug shows console.debug + console.info messages. Drop app into phonegap and it does not work.
>  
> Cause: console.debug/info are not defined.
> Fix: add debug+info protypes to console:
> https://github.com/jknight/incubator-cordova-js/blob/patch-1/lib/ios/plugin/ios/console.js

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira