Replaced if (debug) {log()} by trace().