ibm-js/dapp

Improve logging support in dapp

edchat opened this issue · 6 comments

The recent updates to the Transition controller required better logging support to allow logging of the things related to the Transition flow without all of the other logging cluttering up the log. So support was added in Transition.js to log the transition flow if an option is set in the config.json, instead of using the app: {debugApp: 1}, flag in the index.html file.

Perhaps dapp should support options like debugAppAll, debugAppTransitions, debugAppLoad, debugAppHistory? And then have debugApp by itself do debugAppAll, and have the other ones only log things if they are set true.

I think it is much easier to update the applications config.json than it is to update the index.html to set things in the dojo config (like we have to do for logging in dojox/app with:

data-dojo-config="  app: {debugApp: 1}"

I would like to add an "appLogging" section into the config.json to setup the options for logging.

    "appLogging": {
        "logAll": 0, // if this is set true it is like setting  data-dojo-config="  app: {debugApp: 1}
        "logTimeStamp": 1, // add a timestamp to each log message
        // entries in the loggingList array will be used to see if specific log messages should be logged
        // by checking to see if the first arg matches an entry in the array when logAll is false 
        "loggingList": [ 
            "logAppTransitions"
        ]
    },

We should also move the logging code out of main.js and into a logger.js in util, or have it be a customizable via the config as well so that the app can extend or replace the logger if necessary.

Need to look at the logger support in cordova to be sure that dapp logging is consistent with that, and that it is possible to log to the cordova logger with a config setting.

debugAppAll, debugAppTransitions, debugAppLoad, debugAppHistory

sounds a lot flags .. what about a single flag which would take several values?

Ok, I will plan to remove the inline logging and setup the logging controller to cover the logging by watching for relevant events and logging them.

The inline logging was removed, and a new event based Logger controller was created with this commit db863da
The only flag used now is "appLogging": {"logAll": 1} but we may want to add additional flags to only log specific things.

Add logging for the history support