Refactor the logger to be more reusable