Skip to content

Commit

Permalink
show timestamp when fcm notification is received
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcottle committed Dec 5, 2021
1 parent 721f7d8 commit 7ce1eae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,15 @@ async function fcmListen(options) {
// parse notification body
const body = JSON.parse(notification.data.body);

// generate timestamp
const timestamp = new Date().toLocaleString();

// log timestamp the notification was received (in green colour)
console.log('\x1b[32m%s\x1b[0m', `[${timestamp}] Notification Received`)

// log notification body
console.log(body);

});
}

Expand Down

0 comments on commit 7ce1eae

Please sign in to comment.