[enh] hostname in mails body as well

This commit is contained in:
2019-06-11 13:50:02 +02:00
parent 1aa42aa0e8
commit 2f873d9b67

View File

@@ -36,7 +36,7 @@ export const mail = {
console.log('Connection established')
await sendMail(conf.mail, `[dwatcher] [${os.hostname}] Connection established`, `
<p>
Connection to ${target} established on ${moment().format('DD-MM-YYYY HH:mm:ss')}.
Connection from [${os.hostname}] to ${target} established on ${moment().format('DD-MM-YYYY HH:mm:ss')}.
</p>
`)
}
@@ -48,7 +48,7 @@ export const mail = {
console.log('Waiting %s seconds...', waitingDelay)
await sendMail(conf.mail, `[dwatcher] [${os.hostname}] Connection closed`, `
<p>
Connection to ${target} was lost on ${moment().format('dd-MM-YYYY HH:mm:ss')}.
Connection from [${os.hostname}] to ${target} was lost on ${moment().format('dd-MM-YYYY HH:mm:ss')}.
</p>
<p>
Waiting ${(waitingDelay / 1000).toFixed(0)} seconds before trying to reconnect.
@@ -62,7 +62,7 @@ export const mail = {
console.log('Connection recovered')
await sendMail(conf.mail, `[dwatcher] [${os.hostname}] Connection recovered`, `
<p>
Connection to ${target} was recovered on ${moment().format('dd-MM-YYYY HH:mm:ss')}.
Connection from [${os.hostname}] to ${target} was recovered on ${moment().format('dd-MM-YYYY HH:mm:ss')}.
</p>
`)
}
@@ -73,7 +73,7 @@ export const mail = {
console.error(e.message || e)
// await sendMail(conf.mail, `[dwatcher] Connection error`, `
// <p>
// Connection error with ${target} on ${moment().format('dd-MM-YYYY HH:mm:ss')}:
// Connection from [${os.hostname}] error with ${target} on ${moment().format('dd-MM-YYYY HH:mm:ss')}:
// </p>
// <p>
// ${e.message}