JJM152 / Queen

Queen of the Seas Game
GNU General Public License v2.0
12 stars 13 forks source link

A setting for debug logs? #66

Open ezsh opened 6 years ago

ezsh commented 6 years ago

We have quite many console.log() calls now that are not hidden behind the debug mode test. If they are meant to be used by users when investigating problems, perhaps we can hide them under a game settings?

log(category, message) {
    if (SugarCube.settings[category] == true) {
        if (typeof(message) == "string") {
            console.log("LOG["+ category + "]: " + message);
        } else {
            console.log("LOG["+ category + "]:"); console.log(message);
        }
    }
}
JJM152 commented 6 years ago

Yeah that's a good idea, if you want to clean this up go ahead.

I've also started an issue for a general debug namespace - #36

I have code, for instance, that validates some data structures. I would like to consolidate this, then have it run on load of the game and give a report (basically test all the game data to make sure it's valid). Potentially this could be on by default but turned off if people want. If you wanted to have a hack at that as well, this might be a good time to do so.

PS: May want to add a group parameter to use console.group(arg) ? and some way to call console.groupend() as well?? Hmm.