refactor and add test
refactor logger class