Skip to content

console.context() returns inert object #56634

Open
@rotu

Description

Version

v22.13.0

Platform


Subsystem

No response

What steps will reproduce the bug?

let anon = console.context();
anon.log("I should be logged to console");

let named = console.context('name');
named.log("I should be logged to console too");

How often does it reproduce? Is there a required condition?

Every time you try to log anything via a context returned from console.context.

What is the expected behavior? Why is that the expected behavior?

The example should log the provided strings to console. This is the behavior in Chrome.

Otherwise, if Node does not intend to support these features, context() should not be exposed or should throw a runtime warning/error.

What do you see instead?

The above reproduction code does not log anything to the console, in the repl nor interactively.

Additional information

This (not well-documented) feature allows for multiple loggers to not conflict. E.g. calling console.group in one context does not affect the nesting level of another context. E.g. console.time in one context does not upset timers in another context.

It seems like the console.Console constructor is meant to work similarly.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions