refactor for logger