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

excessive logging from replay #7

Closed
seanghods opened this issue Oct 11, 2024 · 2 comments · Fixed by PostHog/posthog-js-lite#284
Closed

excessive logging from replay #7

seanghods opened this issue Oct 11, 2024 · 2 comments · Fixed by PostHog/posthog-js-lite#284
Labels
enhancement New feature or request

Comments

@seanghods
Copy link

Bug description

We're seeing excessive logging, even with enableSessionReplay: false. Is there an ability to turn this off or is it a bug? We tried debug(false) with no success.

Screenshot 2024-10-11 at 4 33 41 PM

How to reproduce

function initPosthog(): TPostHog | undefined {
  try {
    if (
      process.env.EXPO_PUBLIC_POSTHOG_API_KEY &&
      process.env.EXPO_PUBLIC_POSTHOG_HOST_URL
    ) {
      const posthog = new PostHog(process.env.EXPO_PUBLIC_POSTHOG_API_KEY, {
        host: process.env.EXPO_PUBLIC_POSTHOG_HOST_URL,
        enableSessionReplay: false,
      })
      //NOTE: Debug reduces logging, see https://github.com/PostHog/posthog-js/issues/1387
      posthog.debug(false)
      return posthog
    } else {
      return undefined
    }
  } catch (error) {
    // NOTE: Only log since analytics failing to initialize should not block anything
    LOG.error('Failed to initialize PostHog', error)
    return undefined
  }
}
@marandaneto
Copy link
Member

Hello @seanghods thanks for the issue.
Session replay config: ... is only displayed because session replay is enabled in your project config.
I think it makes more sense to address logging in this issue since it'll improve all the other noisy loggings as well.
For a quick fix at least, I opened this PR

@seanghods
Copy link
Author

Thank you for the quick response! Looks good

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

Successfully merging a pull request may close this issue.

2 participants