Closed Phault closed 6 months ago
Thanks, @Phault!
While we're in here, I wonder if it would be a good time to consider how we could support variadic args for the console functions.
For example, in JS, console.log
takes any number of args and logs them, e.g.:
console.log("this", "is", "a", variable, 42, {a: 1}, [1, 2, variable, 3])
We only support using the first arg.
How close can we get these functions?
cc/ @bhelx
Thanks for contributing! Let's merge this as is. I think it's a welcome addition. I'll create an issue for making these compatible with the w3c console.log, etc. I do think it might be easier to, instead of implementing some of these globals like console
in rust, just expose the IO primitives from rust and implement it in JS in the polyfill layer. Open to different ideas on how to do it though.
Noticed
console.debug
was missing, so figured I'd add it. It's also not obvious what log levelconsole.log
has, so I addedconsole.info
as well as an alias, which seems to match browser behaviour.Diff looks a bit confusing, as I sorted the functions based on log level. 🤷