refactor debug log