Improved logging
All checks were successful
Silvanus Production Dockerization / build (pull_request) Successful in 12s
All checks were successful
Silvanus Production Dockerization / build (pull_request) Successful in 12s
This commit is contained in:
parent
314b793042
commit
0463695323
@ -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"]
|
||||
|
2
main.js
2
main.js
@ -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.");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user