예제 1-3 함수에 로그를 출력하는 로직 추가하기
// number-parser3.js
let total = 0;
const totalSoFar = () => {
return total;
};
const logger = makeLogger();
const sum = (numbers) => {
const [a, b] = numbers.split(',');
➊
logger.info('this is a very important log output', { firstNumWas: a, secondNumWas: b, });
const result = Number.parseInt(a, 10) + Number.parseInt(b, 10);
total += result;
return result;
};
➊ 새롭게 추가한 종료점이다.