refactor in logging