This commit is contained in:
Vladyslav Matsiiako
2023-05-23 15:41:43 -07:00
2 changed files with 16 additions and 1 deletions
+2
View File
@@ -0,0 +1,2 @@
backend/node_modules
frontend/node_modules
+14 -1
View File
@@ -4,6 +4,7 @@ import (
"github.com/Infisical/infisical-merge/packages/util" "github.com/Infisical/infisical-merge/packages/util"
"github.com/denisbrodbeck/machineid" "github.com/denisbrodbeck/machineid"
"github.com/posthog/posthog-go" "github.com/posthog/posthog-go"
"github.com/rs/zerolog/log"
) )
var POSTHOG_API_KEY_FOR_CLI string var POSTHOG_API_KEY_FOR_CLI string
@@ -13,11 +14,23 @@ type Telemetry struct {
posthogClient posthog.Client posthogClient posthog.Client
} }
type NoOpLogger struct{}
func (NoOpLogger) Logf(format string, args ...interface{}) {
log.Debug().Msgf(format, args...)
}
func (NoOpLogger) Errorf(format string, args ...interface{}) {
log.Debug().Msgf(format, args...)
}
func NewTelemetry(telemetryIsEnabled bool) *Telemetry { func NewTelemetry(telemetryIsEnabled bool) *Telemetry {
if POSTHOG_API_KEY_FOR_CLI != "" { if POSTHOG_API_KEY_FOR_CLI != "" {
client, _ := posthog.NewWithConfig( client, _ := posthog.NewWithConfig(
POSTHOG_API_KEY_FOR_CLI, POSTHOG_API_KEY_FOR_CLI,
posthog.Config{}, posthog.Config{
Logger: NoOpLogger{},
},
) )
return &Telemetry{isEnabled: telemetryIsEnabled, posthogClient: client} return &Telemetry{isEnabled: telemetryIsEnabled, posthogClient: client}