refactoring log logic into it's own package