Small refactor of logging.