I'm trying to output the node red logs into a table for easy debuging on my phone.... The problem is str needs to be a string of json, not the type [object Object] which it keeps giving me. Ive tried converting to string multiple ways with no luck.
I have the following function:
let logs = flow.get('logs') || []
var str = msg.payload.message
// prepare the row (keep other columns as-is)
let row = [
//msg.payload.time || '',
//msg.payload.type || '',
msg.payload.source,
str,
]
// debug: this needs to print a string! but it returns an object
node.error(str)
logs.push(row)
// cap at 20 rows
if (logs.length > 20) logs.shift()
flow.set('logs', logs)
msg.payload = logs
return msg