Skip to content

Add ability to customize the default logger #9210

Open
@DCzajkowski

Description

@DCzajkowski

Problem Statement

Currently, the default logger used by Sentry is globalThis.console. However, our app has multiple transports for logging (remote, file, console etc.)

With current Sentry implementation, we cannot redirect default Sentry logs to any of our transports without modifying the global console object.

Solution Brainstorm

We suggest adding a new configuration option that allows to specify the logging module, the same way you can specify a transport.

I would expect LoggerConsoleMethods to be exported as a common interface to adhere to. The logger configuration option would be:

// When specified, used in place of the global `console.log`.
logger?: LoggerConsoleMethods

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Status

    No status

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions