Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ type Config struct {
// If none is specified the client uses `http.DefaultTransport`.
Transport http.RoundTripper

// The logger used by the client to output info or error messages when that
// Logger used by the client to output info or error messages when that
// are generated by background operations.
// If none is specified the client uses a standard logger that outputs to
// `os.Stderr`.
// `os.Stderr`. Override this to suppress log messages.
Logger Logger

// Properties that will be included in every event sent by the client.
Expand Down Expand Up @@ -169,7 +169,7 @@ func makeConfig(c Config) Config {
}

if c.Logger == nil {
c.Logger = newDefaultLogger()
c.Logger = newDefaultLogger(c.Verbose)
}

if c.BatchSize == 0 {
Expand Down
6 changes: 5 additions & 1 deletion examples/featureflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func TestIsFeatureEnabled(projectAPIKey, personalAPIKey, endpoint string) {
client, _ := posthog.NewWithConfig(projectAPIKey, posthog.Config{
client, err := posthog.NewWithConfig(projectAPIKey, posthog.Config{
Interval: 30 * time.Second,
BatchSize: 100,
Verbose: true,
Expand All @@ -18,6 +18,10 @@ func TestIsFeatureEnabled(projectAPIKey, personalAPIKey, endpoint string) {
DefaultFeatureFlagsPollingInterval: 5 * time.Second,
FeatureFlagRequestTimeout: 3 * time.Second,
})
if err != nil {
fmt.Println("error:", err)
return
}
defer client.Close()

boolResult, boolErr := client.IsFeatureEnabled(
Expand Down
5 changes: 3 additions & 2 deletions feature_flags_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4547,11 +4547,12 @@ func TestFlagWithTimeoutExceeded(t *testing.T) {
}))
defer server.Close()

client, _ := NewWithConfig("Csyjlnlun3OzyNJAafdlv", Config{
client, err := NewWithConfig("Csyjlnlun3OzyNJAafdlv", Config{
PersonalApiKey: "some very secret key",
Endpoint: server.URL,
FeatureFlagRequestTimeout: 10 * time.Millisecond,
})
require.NoError(t, err)
defer client.Close()

isMatch, err := client.IsFeatureEnabled(
Expand Down Expand Up @@ -4634,7 +4635,7 @@ func TestFlagDefinitionsWithTimeoutExceeded(t *testing.T) {
PersonalApiKey: "some very secret key",
Endpoint: server.URL,
FeatureFlagRequestTimeout: 10 * time.Millisecond,
Logger: StdLogger(log.New(&buf, "posthog-test", log.LstdFlags)),
Logger: StdLogger(log.New(&buf, "posthog-test", log.LstdFlags), false),
})
defer client.Close()

Expand Down
Loading
Loading