Skip to content

Allow option to force the ConsoleLogger to use console.* instead of process.*.write #15483

@yawhide

Description

@yawhide

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

I use Jest and Jest has a feature where they buffer calls to console.*. But they do not buffer calls to process.*.write.
We built a custom jest reporter to decide whether to show logs or not depending if a test case fails.

Unfortunately, all of the internal logs that I cant control (logs from kafka microservice or unhandled exceptions being logged), completely bypass jest and always get logged to the console

Describe the solution you'd like

Winston has an option in their console transport forceConsole. If true, they use console.log, otherwise they use process.*.write
https://github.com/winstonjs/winston/blob/master/lib/winston/transports/console.js#L34

It would be great if there was an option in Nestjs that tells the console logger to use console.log instead of process.*.write

Teachability, documentation, adoption, migration strategy

You dont have to worry about backwards compatibility

What is the motivation / use case for changing the behavior?

described above

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions