mirror of
https://github.com/nioc/xmpp-bot.git
synced 2024-11-10 03:56:48 +01:00
Fix logging multi-line message
This commit is contained in:
parent
157dce7379
commit
1795d9f1c5
2 changed files with 3 additions and 3 deletions
|
@ -74,7 +74,7 @@ module.exports = async (logger, config, xmpp, user, destination, message, type,
|
||||||
if (statusCode === 200) {
|
if (statusCode === 200) {
|
||||||
logger.trace('Response:', body)
|
logger.trace('Response:', body)
|
||||||
if (body && typeof (body) === 'object' && 'reply' in body === true) {
|
if (body && typeof (body) === 'object' && 'reply' in body === true) {
|
||||||
logger.debug(`There is a reply to send back in chat ${destination}: ${body.reply}`)
|
logger.debug(`There is a reply to send back in chat ${destination}: ${body.reply.replace(/\n|\r/g, ' ')}`)
|
||||||
xmpp.send(destination, body.reply, type)
|
xmpp.send(destination, body.reply, type)
|
||||||
return `Message sent. There is a reply to send back in chat ${destination}: ${body.reply}`
|
return `Message sent. There is a reply to send back in chat ${destination}: ${body.reply}`
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ module.exports = (logger, config) => {
|
||||||
|
|
||||||
// declare send chat/groupchat function
|
// declare send chat/groupchat function
|
||||||
this.send = async (to, message, type) => {
|
this.send = async (to, message, type) => {
|
||||||
logger.debug(`Send ${type} message to ${to}: '${message}'`)
|
logger.debug(`Send ${type} message to ${to}: '${message.replace(/\n|\r/g, ' ')}'`)
|
||||||
const stanza = xml(
|
const stanza = xml(
|
||||||
'message', {
|
'message', {
|
||||||
to,
|
to,
|
||||||
|
@ -125,7 +125,7 @@ module.exports = (logger, config) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info(`Incoming ${type} message from ${from} (${fromJid.toString()}) to ${to}`)
|
logger.info(`Incoming ${type} message from ${from} (${fromJid.toString()}) to ${to}`)
|
||||||
logger.debug(`Message: "${message}"`)
|
logger.debug(`Message: "${message.replace(/\n|\r/g, ' ')}"`)
|
||||||
let xmppHook = config.getXmppHookAction(to.toString())
|
let xmppHook = config.getXmppHookAction(to.toString())
|
||||||
if (!xmppHook) {
|
if (!xmppHook) {
|
||||||
logger.error(`There is no action for incoming ${type} message to: "${to}"`)
|
logger.error(`There is no action for incoming ${type} message to: "${to}"`)
|
||||||
|
|
Loading…
Reference in a new issue