From 7ce1eae86bea4adac43bcd668a5b99ba4d0f183d Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 5 Dec 2021 15:47:24 +1300 Subject: [PATCH] show timestamp when fcm notification is received --- cli/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cli/index.js b/cli/index.js index 6a4a220..86d4808 100755 --- a/cli/index.js +++ b/cli/index.js @@ -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); + }); }