Skip to content

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

Closed
@dantheman39

Description

@dantheman39

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions