Add debug flag for console.log
Change console.log to trace