loging refactor