Refactoring console.log