diff --git a/bin/sshx-plugin.js b/bin/sshx-plugin.js index 980fd6d..d055aaf 100644 --- a/bin/sshx-plugin.js +++ b/bin/sshx-plugin.js @@ -9,10 +9,9 @@ const fs = require('fs') // read job info from stdin (sent by Cronicle engine) const job = JSON.parse(fs.readFileSync(process.stdin.fd)) -let pref = '' -if(job.params.annotate) pref = `[${new Date().toISOString()}] ` +let pref = !!job.params.annotate -const print = (text) => process.stdout.write(pref + text + EOL) +const print = (text) => process.stdout.write((pref ? `[${new Date().toISOString()}] ` : '') + text + EOL) const printInfo = (text) => process.stdout.write(`[INFO] \x1b[32m${text}\x1b[0m` + EOL) const printWarning = (text) => process.stdout.write(`[INFO] \x1b[33m${text}\x1b[0m` + EOL) const printError = (text) => process.stdout.write(`\x1b[31m${text}\x1b[0m` + EOL)