Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console.context() #193

Open
foolip opened this issue Jan 27, 2021 · 2 comments
Open

console.context() #193

foolip opened this issue Jan 27, 2021 · 2 comments

Comments

@foolip
Copy link
Member

foolip commented Jan 27, 2021

In the spirit of #27 and #74 I'm filing issues about two additional console members I've spotted as part of foolip/mdn-bcd-collector#917.

console.context(name) is available in Chrome and Node.js, and returns a new object with a lot of the console members. This test gives some clues about what it does:
https://chromium.googlesource.com/v8/v8/+/23d0a6a5125d407655f2b7f6bb7263b4e05019d8/test/inspector/runtime/console-context.js

It looks like console.context('bla').log('hello') doesn't log anything in Node.js, but logs "hello" just like console.log("hello") would in Chrome.

Does anyone recognize what this is, and would it be useful to standardize? I expect not, but want to check.

@nchevobbe
Copy link

it was added as an experiment a while ago in Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=728767
it does provide a nice way to filter logs (as shown in https://twitter.com/hashseed/status/1337709432994750464)

we don't have such thing in Firefox as it's not part of the standard, but I can see it being useful

@domfarolino
Copy link
Member

Interesting, it is a shame that it was never standardized in Chrome. I've posted https://groups.google.com/a/chromium.org/g/devtools-dev/c/umeCeS3Bgcs to see if I can get someone from the Chromium DevTools team to lend a hand here, especially since @nchevobbe seems to think that this would be useful, and thus we have a shot at getting multi-vendor support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants