Node red multi-line status

When working on functions in Node-Red I frequently use the status info you can get out of a function node..

For example..

node.status({fill:"blue",shape:"dot",text:msg.topic + ": " + msg.payload + "
"+ global.get("handyDate") });

Except that in the above and other attempts there is no way to get more than one line of info out - am I missing something or is this deliberate - and if so is there any way around it?

1 Like

Did a few quick tests and I can't find a way to split a line so I'm guessing that newlines are filtered out or ignored.

Correct - status in the dashboard is deliberately limited to one line (and no that isn't about to change) - If it's for debug - you can use node.warn("your data") to send it to the debug side bar.

1 Like

Thanks for responding Dave, I was trying to keep out of the sidebar as there is a lot going on there and the debug adds more info.. Oh, well. How would I send multiline data to the sidebar – that won’t handle
or \r\n either

Pete

Looks that way sadly.

I checked – same situation with node-warn, I can’t see hoe to put out more than one line in a message.

Pete

This works in a function node:

node.warn("this\nis\non\nmultiple\nlines")

return msg;

But you have to expand the output otherwise it looks like a single line with return arrows in it.

msg.payload = "this\nis\non\nmultiple\nlines"
node.warn(msg.payload)

return msg;

image

Honestly though, you probably want to create a simple web ui rather than trying to do everything in the admin ui.

Hi

A separate web page takes up more real estate and is distracting (response to your next comment).

Ok I’m lost – how do you “expand” the output of a node-warn…

If I input “this is it\nyou know” I get a single line in the debug area with “this is it\nyou know”

Pete

Click on the arrow (next to string[25] in the screenshot)

I have a fully updated Nod-Red – don’t know if that makes a difference but I’m not seeing that size option

So do I :sunglasses:
..and using this flow;

[{"id":"79ab3bbc.27c244","type":"inject","z":"31e18edc.98bdc2","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":630,"wires":[["40c5e58c.eeefec"]]},{"id":"40c5e58c.eeefec","type":"function","z":"31e18edc.98bdc2","name":"","func":"msg.payload = \"this\\nis\\non\\nmultiple\\nlines\"\nnode.warn(msg.payload)\n\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":630,"wires":[[]]}]

I get;

print

I stand corrected Paul – your flow DOES work – I must’ve made a mistake..– however, this is not a solution, you have to expand EVERY time - not much use on a page with 50 nodes firing stuff out while debugging.. I don’t know why the Node Red guys are dead set against using the area below a function for inline multiline debugging.. you would not have to use it if you didn’t want it….and if we had html we could use a really small font..

The solution you have would be ok if you did not have to manually expand every time, and even better without the particularly cryptic node name above… do people really hold names like 6b65 ac79.68e354 in their heads?

Oh well, I guess I’ll keep looking for answers…

Pete

1 Like

If you give the function node a name, such as 'Test node' you will get;

image

Well you can pin stuff open but in general I agree.

I use the Vivaldi browser which lets you combine tabs into a split view. Useful sometimes.

??? Not sure how that applies.

Node.warn statements send their output not only to the debug pane but also to the log.
A technique I have used when I have complex diagnostics to follow is to give the function node a name and use node.warn to output the diagnostics. Then in a terminal run
tail -f /var/log/syslog | grep "function name"
The result is that the diagnostics are output to the terminal window and can therefore be watched at leisure, scrolled back over easily, and so on. Debug nodes can also be set to send to the terminal in which case they will appear there too.

That sounds useful Colin - I'll give that a shot. Yes, my bad.. my function node had a horrible name because I didn't actually give it a name. I should know better. Node-Red is on a headless PI in my case and I'm working on my PC, so maybe WinSCP to the log wherever that is might be worth looking at if it saves having to interact with the output.

No, actually with a function node called "my thing" outputting "this\nthat\nother" I just looked at the log exactly as your suggestion.

Mar 10 10:11:36 raspberry-two Node-RED[388]: 10 Mar 10:11:36 - [warn] [function:my thing] t his

No sign of "that or "other"

pi@raspberry-two:~:10:13[130]> tail -f /var/log/syslog | grep "my thing"
Mar 10 10:11:36 raspberry-two Node-RED[388]: 10 Mar 10:11:36 - [warn] [function:my thing] this
Mar 10 10:14:26 raspberry-two Node-RED[388]: 10 Mar 10:14:26 - [warn] [function:my thing] this
Mar 10 10:14:46 raspberry-two Node-RED[388]: 10 Mar 10:14:46 - [warn] [function:my thing] this
Mar 10 10:14:47 raspberry-two Node-RED[388]: 10 Mar 10:14:47 - [warn] [function:my thing] this
Mar 10 10:14:48 raspberry-two Node-RED[388]: 10 Mar 10:14:48 - [warn] [function:my thing] this
Mar 10 10:14:51 raspberry-two Node-RED[388]: 10 Mar 10:14:51 - [warn] [function:my thing] this

I can see the whole message in the degug window - but only the first word in the log output.

and it isnt truncating as the phrase "this is it you know" comes out, nothing after the "\n" though.

The other lines are there, but they haven't got the function name in them Try
tail -f /var/log/syslog | grep -A 2 "function name"
That will show the next two lines too.

Alternatively you could just use
node-red-log
which will show all the node red messages.

Already figured I'm chasing the holy grail and am likely to be disappointed. Didn't you at some point do a Node-Red dashboard debug window - a long time ago? I'm looking for multi-line output from a function node - and without using the debug window... I'm chatting with Colin....see elsewhere in here

2 Likes