Refactor logging module.