Improved logging
All checks were successful
Silvanus Production Dockerization / build (pull_request) Successful in 12s

This commit is contained in:
Skylar Grant 2023-08-27 19:34:15 -04:00
parent 314b793042
commit 0463695323
3 changed files with 5 additions and 2 deletions

View File

@ -5,5 +5,4 @@ WORKDIR /usr/src/app
COPY package.json ./
RUN npm install
COPY . .
# CMD ["/bin/sh", "-c", "node main.js 2> /logs/silvanus.err 1> /logs/silvanus.log"]
CMD ["/bin/sh", "-c", "node main.js 2> /logs/error/$(date +%Y-%m-%d_%H-%M-%S).txt 1> /logs/status/$(date +%Y-%m-%d_%H-%M-%S).txt"]
CMD ["/bin/sh", "-c", "node main.js 2>&1 > /logs/$(date +%Y-%m-%d_%H-%M-%S).txt"]

View File

@ -52,6 +52,8 @@ client.once('ready', async () => {
fn.sendHeartbeat(heartbeatUrl);
}, 30000);
if (isDev) console.log("Heartbeat interval set.");
} else {
if (isDev) console.log("No heartbeat URL set, will not send heartbeats for uptime monitoring.");
}
});

View File

@ -1146,11 +1146,13 @@ const functions = {
},
async sendHeartbeat(url) {
https.get(url, async (response) => {
if (isDev) console.log("Sent Heartbeat Request: " + url);
let data = '';
response.on('data', (chunk) => data += chunk);
response.on('end', () => {
if (isDev) console.log("Received Heartbeat Response: " + data);
parsedData = JSON.parse(data);
if ( !(parsedData.ok) ) console.error("Heartbeat failed");
});