Add a debug flag in Options. And log to console.log only if this is enabled

Created by: mgueury

Not sure it will change a lot, but it is to improve the performance and make it a little cleaner.