Skip to content

Commit 9158485

Browse files
authored
Suppress PostHog logs (#635)
1 parent c435eb3 commit 9158485

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pkg/analytics/analytics.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func Init(version string, enabled bool) *Client {
4545
var err error
4646
client, err = posthog.NewWithConfig(key, posthog.Config{
4747
Endpoint: apiHost,
48+
Logger: noopLogger{},
4849
})
4950
if err != nil {
5051
client = nil

pkg/analytics/logger.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package analytics
2+
3+
// noopLogger implements the posthog.Logger interface
4+
// It suppresses all PostHog SDK logs
5+
type noopLogger struct{}
6+
7+
func (noopLogger) Debugf(format string, args ...interface{}) {}
8+
9+
func (noopLogger) Logf(format string, args ...interface{}) {}
10+
11+
func (noopLogger) Warnf(format string, args ...interface{}) {}
12+
13+
func (noopLogger) Errorf(format string, args ...interface{}) {}

0 commit comments

Comments
 (0)