From 42785fe8b95a89badcafc80c5c7c9cf1f33ea908 Mon Sep 17 00:00:00 2001 From: joseph le Date: Fri, 20 Oct 2023 09:41:46 +0700 Subject: [PATCH] update write for functions --- app/utils/{addLogFunction.js => addLogFunctionJS.js} | 4 +++- app/utils/powerSchedule.js | 2 +- app/utils/sendStatusOtherSystem.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) rename app/utils/{addLogFunction.js => addLogFunctionJS.js} (88%) diff --git a/app/utils/addLogFunction.js b/app/utils/addLogFunctionJS.js similarity index 88% rename from app/utils/addLogFunction.js rename to app/utils/addLogFunctionJS.js index 532e3fb..c1519a7 100644 --- a/app/utils/addLogFunction.js +++ b/app/utils/addLogFunctionJS.js @@ -1,7 +1,7 @@ const fs = require("fs"); const moment = require("moment"); -export const addLogFunction = async (fileName, data, functionName) => { +const addLogFunction = async (fileName, data, functionName) => { try { fs.exists(fileName, async (exists) => { if (exists) { @@ -32,3 +32,5 @@ export const addLogFunction = async (fileName, data, functionName) => { console.log(error); } }; + +module.exports.addLogFunction = addLogFunction; \ No newline at end of file diff --git a/app/utils/powerSchedule.js b/app/utils/powerSchedule.js index 4870ee5..dd82cf9 100644 --- a/app/utils/powerSchedule.js +++ b/app/utils/powerSchedule.js @@ -1,6 +1,6 @@ const puppeteer = require("puppeteer"); const zulip = require("zulip-js"); -const { addLogFunction } = require("./addLogFunction"); +const { addLogFunction } = require("./addLogFunctionJS"); (async () => { // Launch a headless browser diff --git a/app/utils/sendStatusOtherSystem.js b/app/utils/sendStatusOtherSystem.js index dcb7243..361d7aa 100644 --- a/app/utils/sendStatusOtherSystem.js +++ b/app/utils/sendStatusOtherSystem.js @@ -4,7 +4,7 @@ const moment = require("moment"); const zulip = require("zulip-js"); const { exec } = require("child_process"); const fs = require("fs"); -const { addLogFunction } = require("./addLogFunction"); +const { addLogFunction } = require("./addLogFunctionJS"); const config = { username: "networktool-bot@zulip.ipsupply.com.au",