Open josephjclark opened 2 months ago
I think, @josephjclark , that lightning initially expected an array of strings or objects as the basic unit of logs from the worker. This might explain the behaviour we're seeing now.
@stuartc , do you remember/know what might be causing this?
We've noticed some strange behaviour in the Lightning log viewer where items in arrays are not pretty printed.
In fact,the logger seems to entirely ignore arrays.
Repro
Run this against common in lightning:
The logs say:
But they SHOULD say:
Note that an array inside an object is fine:
Worker output
The object going out of the Worker contains a message array (because
console.log(a,b,c)
lets you log multiple things). This in turn contains a single item, itself an array.I can see this in my Javascript debugger immediately before it's sent to the phoenix web socket:
So I'm pretty sure this isn't a worker issue.
So what's up?
Adding a breakpoint to
log-viewer/store.tryPrettyJSON
, I can see that the message comes as a flat string -22
not[22]
. So the logger won't try and pretty print it or anything.It looks to me like the messages array is getting stringified and flattened?