Fwiw, Javascript’s object logging is a feature I often miss in other languages. If you just want to log the string, use formatted strings or just log obj+“” like you would need to do in every other language. Or even better, log a copy, like you probably wanted to do, with {…obj}.
I have many gripes with Javascript, but the logging API is pretty solid.
I’ve never had a complaint about logging stuff in python. It generally does what I expect.
“Create a copy of your object and print that” is what I ended up doing, but I don’t think most people would say that’s intuitive. I expect if i print something at a particular time, I get what it is at that point in time.
I’d just like to highlight what you mention below: Logging it as an object allows you to inspect it in the browser console, presumably with some JSON tree representation, rather than just a dumb string.
Fwiw, Javascript’s object logging is a feature I often miss in other languages. If you just want to log the string, use formatted strings or just log obj+“” like you would need to do in every other language. Or even better, log a copy, like you probably wanted to do, with {…obj}.
I have many gripes with Javascript, but the logging API is pretty solid.
I’ve never had a complaint about logging stuff in python. It generally does what I expect.
“Create a copy of your object and print that” is what I ended up doing, but I don’t think most people would say that’s intuitive. I expect if i print something at a particular time, I get what it is at that point in time.
I’d just like to highlight what you mention below: Logging it as an object allows you to inspect it in the browser console, presumably with some JSON tree representation, rather than just a dumb string.
It’s described in the “Outputting a single object” example here: https://developer.mozilla.org/en-US/docs/Web/API/console#examples