[enh] better name for target in mails/logs

This commit is contained in:
2019-06-20 13:17:46 +02:00
parent 129fa99593
commit 7c287a5d78
2 changed files with 10 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ export const mail = {
onEstablished: (conf: Conf, target: string) => {
return async () => {
console.log('Connection established')
console.log('Connection established for %s', target)
await sendMail(conf.mail, `[dwatcher] [${os.hostname}] Connection established`, `
<p>
Connection from [${os.hostname}] to ${target} established on ${moment().format('DD-MM-YYYY HH:mm:ss')}.
@@ -44,8 +44,8 @@ export const mail = {
onDisconnect: (conf: Conf, target: string) => {
return async (waitingDelay: number) => {
console.log('Connection closed')
console.log('Waiting %s seconds...', waitingDelay)
console.log('Connection closed for %s', target)
console.log('Waiting %s seconds...', (waitingDelay / 1000).toFixed(0))
await sendMail(conf.mail, `[dwatcher] [${os.hostname}] Connection closed`, `
<p>
Connection from [${os.hostname}] to ${target} was lost on ${moment().format('dd-MM-YYYY HH:mm:ss')}.
@@ -59,7 +59,7 @@ export const mail = {
onRestartSuccess: (conf: Conf, target: string) => {
return async () => {
console.log('Connection recovered')
console.log('Connection recovered for %s', target)
await sendMail(conf.mail, `[dwatcher] [${os.hostname}] Connection recovered`, `
<p>
Connection from [${os.hostname}] to ${target} was recovered on ${moment().format('dd-MM-YYYY HH:mm:ss')}.