Skip to content

Commit

Permalink
Add logging to sendNews example
Browse files Browse the repository at this point in the history
  • Loading branch information
heptacode committed Feb 21, 2023
1 parent ef4ea07 commit 37aa9f5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/sendNews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,33 @@ async function composeNews(trainee: Trainee, newsList: NewsPayload[]) {
case TraineeType.ARMY:
default:
// 더캠프 로그인
console.log('더캠프 로그인 [시작]');
await army.login({
id: process.env.THECAMP_ID!,
password: process.env.THECAMP_PW!,
});
console.log('더캠프 로그인 [완료]');

// 보고싶은 군인 추가
console.log('보고싶은 군인 추가 [시작]');
await army.addTrainee(trainee);
console.log('보고싶은 군인 추가 [완료]');

// 카페 개설여부 확인
console.log('카페 개설여부 확인 [시작]');
if (!(await army.checkCafe(trainee))) {
console.log(`카페 개설여부 확인 [건너뜀: ${trainee.name}]`);
return;
}
console.log('카페 개설여부 확인 [완료]');

// 뉴스 전송
console.log('뉴스 전송 [시작]');
for (const newsItem of newsList) {
await army.sendNews(trainee, newsItem);
log.s(`육군 ${trainee.name} > ${newsItem.category.toUpperCase()}`);
}
console.log('뉴스 전송 [완료]');
return;
}
}
Expand Down

0 comments on commit 37aa9f5

Please sign in to comment.