Skip to content

Commit 7ce1eae

Browse files
committed
show timestamp when fcm notification is received
1 parent 721f7d8 commit 7ce1eae

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cli/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,15 @@ async function fcmListen(options) {
198198
// parse notification body
199199
const body = JSON.parse(notification.data.body);
200200

201+
// generate timestamp
202+
const timestamp = new Date().toLocaleString();
203+
204+
// log timestamp the notification was received (in green colour)
205+
console.log('\x1b[32m%s\x1b[0m', `[${timestamp}] Notification Received`)
206+
201207
// log notification body
202208
console.log(body);
209+
203210
});
204211
}
205212

0 commit comments

Comments
 (0)