OverlayPlugin icon indicating copy to clipboard operation
OverlayPlugin copied to clipboard

Add event for overlayplugin log message

Open quisquous opened this issue 4 years ago • 1 comments

It'd be handy if everything showed up in the overlayplugin log could be subscribed to by an overlay, so it could (potentially) show that in game.

This would help me do things like see errors when they happen on stream, or add console.log debugging that would show up in real time in an overlay vs in a window on another monitor.

quisquous avatar Nov 03 '20 02:11 quisquous

The next OverlayPlugin update already contains a mechanism which overlays can use to talk to each other. The broadcast handler raises a BroadcastMessage event each time it is called. You can pass a source and a message (msg). The source is intended to identify the source overlay to allow subscribers to filter out unknown messages. You could then replace the browser's native console.log function with one that forwards all log messages to the broadcast handler and subscribe to the BroadcastMessage event in the overlay that will display the log / error messages. I'd prefer this solution since OverlayPlugin's log can get fairly spammy in debug versions and it'd break the separation between overlays (overlays could see log messages from all enabled overlays). The broadcast method also works over WebSocket which OverlayPlugin itself couldn't support (since it obviously can't capture a remote browser's log). That said, I'm open to discuss this further.

ngld avatar Dec 10 '20 22:12 ngld