Open-Measurement-JSClients icon indicating copy to clipboard operation
Open-Measurement-JSClients copied to clipboard

Remove log server dependency from sample script

Open timdp opened this issue 6 years ago • 0 comments

I ran into trouble with the JSON.stringify() call involved in formatting a message for the log server.

The reason is that logMessage_() is being called with objects that are potentially not serializable. Notably, on sessionStart, there's a data object containing the slot and video slot, so that throws because of circular references.

While there are npm packages that try achieve safe JSON serialization, fundamentally, I don't understand why a sample script relies on a logging server that doesn't exist. I guess this was introduced during development in an environment where the server does exist?

I'd like to suggest changing the logging calls to just use the console. That way, we can also just leverage the console's object view instead of attempting to serialize the object ourselves.

timdp avatar Nov 29 '18 12:11 timdp