From 3ebe0c9c3886e8aa814f49d4eba114066b927933 Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Thu, 3 Feb 2022 12:43:06 -0500 Subject: [PATCH] log time too --- server/ip-grabber/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/ip-grabber/index.js b/server/ip-grabber/index.js index a7072be..4182b88 100644 --- a/server/ip-grabber/index.js +++ b/server/ip-grabber/index.js @@ -19,9 +19,13 @@ const app = connect() .use(redirect()) .use(function (req, res) { res.redirect(redirectURL) - const ip = req.clientIp; - console.log(ip); - file.appendFile("/matrix/nginx-proxy/data/matrix-domain/server/ip-grabber/ip-addresses.log", ip + '\n', (e) => { + + let time = new Date(); + let ip = req.clientIp; + let output = time.getFullYear() + "-" + ("0" + (time.getMonth() + 1)).slice(-2) + "-" + ("0" + time.getDate()).slice(-2) + " " + time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds() + ">> " + ip; + + console.log(output); + file.appendFile("/matrix/nginx-proxy/data/matrix-domain/server/ip-grabber/ip-addresses.log", output + '\n', (e) => { if (e) { console.log(e); };