const jsonToString = (json) => { try { return JSON.stringify(json); } catch (ex) { return stringifySafe(json, null, null, () => {}); } }
_sendMessagesUDP() { const udpSentCallback = (err) => { if (err) { this._debug(`Error while sending udp packets. err = ${err}`); this.callback(new Error(`Failed to send udp log message. err = ${err}`)); } }; this.messages.forEach((message) => { const msg = message; msg.token = this.token; const buff = Buffer.from(stringifySafe(msg)); this._debug('Starting to send messages via udp.'); this.udpClient.send(buff, 0, buff.length, this.port, this.host, udpSentCallback); }); }
value = stringifySafe(value);