question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Collect console.debug, info and warn too

See original GitHub issue

Right now only console.error is being enhanced to report errors to Datadog. I would like too:

  • Be able to redirect console.debug, console.info and console.warn to Datadog (depending on the log level of course).
  • Be able to hide console messages in my production environment.

Reasons: Right now I log to datadog when I am in my production environment. In my localhost environment, I want to log into the console. If I use “datadogLogs.logger.debug”, in my localhost environnement I have on those ugly warnings: logs.logger.debug' not yet available, please call '.init()' first. I could wrap all my log conditionally like this of course:

      if (process.env.REACT_APP_DATADOG_CLIENT_TOKEN) {
        datadogLogs.logger.debug('...')
      } else {
        console.debug('...')
      }

But that’s way too much code for one log.

Suggestion Improve startConsoleTracking to handle all logging methods from the console. Also, do not apply originalConsoleError all the time: use a configurable parameter to skip this part conditionnaly.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
bcaudancommented, May 28, 2020

Hello @fromi,

Thanks for the feedback! It is something that we plan to do in the coming weeks.

We will ping here when it will be available.

0reactions
BenoitZugmeyercommented, Apr 21, 2022

This feature has been released in the Logs Browser SDK v4.8.0! See forwardConsoleLogs initialization parameter in the documentation

Read more comments on GitHub >

github_iconTop Results From Across the Web

When to use the different log levels - Stack Overflow
For me, you should start with DEBUG , INFO , WARNING and ERROR . Developers should see all levels. SysAdmins up to INFO...
Read more >
console.debug() - Web APIs - MDN Web Docs
The console.debug() method outputs a message to the web console at the "debug" log level. The message is only displayed to the user...
Read more >
Spark - Stop INFO & DEBUG message logging to console?
Now, Let's see how to stop/disable/turn off logging DEBUG and INFO messages to the console or to a log file. Using sparkContext.setLogLevel() ...
Read more >
Logging HOWTO — Python 3.11.1 documentation
DEBUG ) logging.debug('This message should go to the log file') logging.info('So should this') logging.warning('And this, too') logging.error('And non-ASCII ...
Read more >
Log messages in the Console tool - Microsoft Edge ...
Before DevTools, for JavaScript, you were limited to an alert() or document.write() statement to debug in the browser. With DevTools, to log ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found