Improve log library, integrate it in scans.js and misc.js