browser-sdk icon indicating copy to clipboard operation
browser-sdk copied to clipboard

💡 Improvements to console forwarding

Open seanbecker15 opened this issue 9 months ago • 1 comments

Is your feature request related to a problem? Please describe. From what I can tell, it's currently not possible to reconfigure the console logging strategy post-configuration. Consequently, I had to implement my own version of the console forwarding and duplicate a lot of the mapping from console api to datadog status within my application.

Describe the solution you'd like Since there are a lot of potential solutions, I don't want to prescribe any particular solution. See alternatives below for some of the things I've come up with. My end goal is to make it easier to change the console forwarding strategy after configuration.

Describe alternatives you've considered

  • Expose console api mappers, types, and enums to make it easier for applications to create their own console logger (which can then be adjusted post-configuration)
  • Expose functions that allow applications to reconfigure the console logging strategy post-configuration
  • Deprecate the forwardConsoleLogs property in favor of adding another logger (i.e., datadogLogs.consoleLogger)
    • I don't find the array contract for this to be all that useful as I rely on using the idea of log levels. Anything above the log level should be captured.

seanbecker15 avatar May 02 '24 13:05 seanbecker15

Hi @seanbecker15, Thank you for your interest. The next step would be to contact support and fill a FEATURE_REQUEST with them.

thomas-lebeau avatar May 08 '24 09:05 thomas-lebeau

@thomas-lebeau feel free to close at your leisure, we ended up going to the route of creating a log wrapper and using our own logic to determine whether we want to forward logs to datadog. Allows us to have more control over this at runtime.

seanbecker15 avatar Jul 09 '24 18:07 seanbecker15