PostHog / posthog-js-lite

Reimplementation of posthog-js to be as light and modular as possible.
https://posthog.com/docs/libraries
MIT License
66 stars 33 forks source link

Add a way to filter debug logging based on a given debugLevel in posthog-react-native #113

Open statico opened 1 year ago

statico commented 1 year ago

Is your feature request related to a problem?

When using <PostHogProvider apiKey={...} debug={__DEV__}>, PostHog produces absurd amounts of logging with "PostHog Debug" messages, especially if you have heavy instrumentation. This is very distracting and can hide more important log messages.

Describe the solution you'd like

Add an option to PostHogProvider like quiet or loggingEnabled={false} that can be used to disable the logging.

Describe alternatives you've considered

Related sub-libraries

Additional context

<3

marandaneto commented 11 months ago

I think the solution here would be to implement a debugLevel so you can define eg debug, error, fatal levels, and this filter out the console logs.

marandaneto commented 8 months ago

Btw you can still do posthog.debug(false) at runtime, or just don't use debug={__DEV__} since it's disabled by default anyway. The loggingEnabled suggestion is pretty much what's already available.