Skip to content

Add page for console.context(name) #692

@nchevobbe

Description

@nchevobbe

Proposal

console.context(label) returns a new object with a lot of the console members. Messages emitted from calling the method from this created object can carry the context name, which can be used to categorize/filter them more easily.


Example:

const logger = console.context("myLogger");
logger.log("Hello");
logger.info("World");

With the example above, in Chrome you can use context:myLogger in the filter input to only display messages emitted from the logger object.


See the whatwg issue (whatwg/console#193) and the (WIP) PR to specifiy it (whatwg/console#244)

Browser support

At the moment console.context is available in Chrome and Node (even though logs emitted from it are not visible, see nodejs/node#56634), and is currently being implemented in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1948870)

Tasks

  • [ ]

Dependencies

Additional information

No response

Are you willing to support this work?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageTriage needed by staff and/or partners. Automatically applied when an issue is opened.proposalAuto label for new proposals added via the suggestion form

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions