send(action, text, ...params) { const { prefix } = this; const clog = clogs[action] || clogs._default; const status = statuses[action] || statuses._default; // function addHash(tag) { // if (['#', '@'].includes(tag[0])) { // } // } const tags = (params.tags || []).map(t => (['#', '@'].includes(t[0]) ? '' : `#${t}`)).join(' '); const errText = params.err; const md = `${status} ${prefix} ${[text, errText].filter(a => a).join('\n')}\n\n${tags}`.trim(); clog(md); const url = [this.base, this.project].join('/'); return axios.post(url, { action, status, text: md, tags: params.tags, }).catch((err) => { console.log(`Logger.${action} error`, err); // eslint-disable-line no-console return null; }); }
send(action, text, ...params) { const { prefix } = this; const clog = clogs[action] || clogs._default; const status = statuses[action] || statuses._default; // function addHash(tag) { // if (['#', '@'].includes(tag[0])) { // } // } const tags = (params.tags || []).map(t => (['#', '@'].includes(t[0]) ? '' : `#${t}`)).join(' '); const errText = params.err; const md = `${status} ${prefix} ${[text, errText].filter(a => a).join('\n')}\n\n${tags}`.trim(); clog(md); const url = [this.base, this.project].join('/'); return axios.post(url, { action, status, text: md, tags: params.tags, }).catch((err) => { console.log(`Logger.${action} error`, err); // eslint-disable-line no-console return null; }); }