Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: print log context to console when the handler is "console" #589

Closed
dantheman39 opened this issue Oct 23, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@dantheman39
Copy link

dantheman39 commented Oct 23, 2020

Hello! When developing locally I set the log handler to "console", to not spam the live site.

datadogLogs.logger.setHandler(
  process.env.DD_ENABLED === "true"
    ? HandlerType.http
    : HandlerType.console
);

The downside to this is that I can't see the context values of the log, which makes this much less useful. This call to the logger:

datadogLogs.logger.info("Switching viewed account", {
  from: oldAccount,
  to: newAccount,
});

Results in this log to the console:

Screen Shot 2020-10-23 at 11 20 47 AM

I can't see the "from" and "to" values I'm sending along, which makes these logs much less useful for debugging (if the handler were "http", I could see these values in the network tab). I end up having to go into the code and setting a console.log if I want to debug things, whereas I would hope that datadog's logger would make that unnecessary.

Either way I hope you all are well, thank you!

@bcaudan
Copy link
Contributor

bcaudan commented Nov 16, 2020

This is available in browser-sdk@1.25.4

@bcaudan bcaudan closed this as completed Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants