Skip to content

Option to skip console errors/logs  #102

@edenhermelin

Description

@edenhermelin

🚀 Feature Proposal

We have a use-case of using this library without a need to write any error to the console if writing to DataDog failed due to network issues, and we would prefer to silently ignore this failure instead.

Motivation

Having the following lines inside datadog.js causes the errors to automatically be shown in the console:

        console.error('The previous log have not been saved')
        console.error(`${err.message}\n${err.stack}`)

Example

An example for a workaround can be adding a new option (or re-using the noStdout option from the CLI and checking it before logging here:

      if (!this._options.noStdout) { 
        console.error('The previous log have not been saved')
        console.error(`${err.message}\n${err.stack}`)
      }

If this workaround makes sense to you please let me know and I'll open a PR. (If there is an alternative, I'll be happy to hear 😃 )

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions