LogService.MessageOut ignores printed tables

LogService.MessageOut does not fire when a table is one of the print arguments.

game:GetService("LogService").MessageOut:Connect(function(message)
	error(message) -- Should error, but doesn't.
end)
print({})
print(true, {}) -- All arguments are ignored if one is a table.

I use run-in-roblox to run tests, which relies on this event to redirect output from Studio to standard output. This issue makes it harder for me to test my game.

4 Likes

The output type may be required, but I am not sure.
I am unable to reproduce this with the output type included.

@GalacticInspired - The issue is not that the message doesn’t show up in the Output window but that it doesn’t make it to the LogService. Are you saying that when including the types the messages make it through? Can you give an example of what you mean, please?

For me, it only happen with Log Mode off

image

image

local c = game:GetService("LogService").MessageOut:Connect(function(message)
	warn("[LogService] Recieved:",message)
end)
print({})
print(true, {})
wait()
c:Disconnect()
Using your code

No Log Mode:
image

Log Mode:

image

@Lielmaster - good observation.

Notice that when LogMode is on, you get no table contents in the Output nor the in the LogService messages. Seeing the table contents might be why the OP is trying to use the LogService.

I didn’t mention it, but this also occurs in live games.

There’s another use case interfered with by this bug. I might build a log table of output with this event, then if an error occurs, send the log table of the output alongside the error to an analytics service. While all printing calls could be replaced to avoid this, that’s inconvenient when using other developers’ packages.

1 Like

This was fixed by 531. :partying_face:

1 Like