Three.js: Disable debug messages?

Created on 6 Sep 2015  ·  6Comments  ·  Source: mrdoob/three.js

I'm currently working on a project that uses a lot of plane geometries combined into a single mesh.

When I'm trying to debug my code, I can't leave the console open while loading because the debug messages "THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint." spam the console, and slow down the loading of the code by displaying them in the console.

It's hanging on some other issue, but I can't open the console to see the errors after the page has frozen from the other issue. Also I can't leave the console open while loading because it drastically slows down my loading time by printing the warning messages :P

Is there a way I can disable these messages? I tried just switching PlaneGeometry to PlaneBufferGeometry but that threw other errors in my code that I don't want to deal with right now. Also I'm currently not worried about memory, currently I just need to have a working (stable of unstable) version of my project working in a couple days to present to my boss.

Suggestion

Most helpful comment

I'm not going to continue this discussion because I think consensus has been reached, but I will just say:

It's very useful for anyone else looking at your app to know just by looking at the console that is was built with three.js, and the version.

I use Vue, Moment, jQuery, Bootstrap, and none of them think it's necessary to log mandatory messages to the console.

All 6 comments

I am not sure If it's possible to disable the log's, but it probably should be, since you would not want that in production builds. (Maybe minifiers take care of it - dont know)

As a workaround you can override the console.log function while loading your meshes, and then reset it, like:

var oldLogFunction = console.log;

console.log = function(){}; // noop

// ... load meshes

console.log = oldLogFunction; // reset console.log

// ... perform debugging

That's works well, just note that in this case it's console.info :)

I agree with what you say about to production thing. I told my partner on this project what was happening, and he was surprised there was no option to disable the log messages

+1 to this. I'm working on a command-line tool that outputs a PNG on stdout, and overwriting console.log isn't a problem, but it is a bit of a wart.

The specific message I have a problem with is this one. It seems like in this specific case adding an option like quiet to the constructor would suffice. But it'd obviously better to have something a bit more all-encompassing I guess...

@crabmusket personally I think that message should always be displayed. It's very useful for anyone else looking at your app to know just by looking at the console that is was built with three.js, and the version. Consider it a tiny bit of advertising you have to put up with for using this free library 😉

Regarding the original issue, I don't think that any console.info messages get displayed anymore anyway, so perhaps this issue can be closed? @mrdoob @Mugen87

I'm not going to continue this discussion because I think consensus has been reached, but I will just say:

It's very useful for anyone else looking at your app to know just by looking at the console that is was built with three.js, and the version.

I use Vue, Moment, jQuery, Bootstrap, and none of them think it's necessary to log mandatory messages to the console.

Was this page helpful?
0 / 5 - 0 ratings