move common javascript for logging into log.js