Refactor logger module