Skip to content

Commit 571a6db

Browse files
Add NewClientWithDetails API (#241)
For multi-instance users, we still need a way to expose the `InitializeDetails`.
1 parent d123c92 commit 571a6db

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

client.go

+12
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ func NewClientWithOptions(sdkKey string, options *Options) *Client {
2929
return client
3030
}
3131

32+
// Initializes a Statsig Client with the given sdkKey and options
33+
// returning the initialized client and details of initialization
34+
func NewClientWithDetails(sdkKey string, options *Options) (*Client, InitializeDetails) {
35+
client, context := newClientImpl(sdkKey, options)
36+
return client, InitializeDetails{
37+
Duration: time.Since(context.Start),
38+
Success: context.Success,
39+
Error: context.Error,
40+
Source: context.Source,
41+
}
42+
}
43+
3244
func newClientImpl(sdkKey string, options *Options) (*Client, *initContext) {
3345
context := newInitContext()
3446
diagnostics := newDiagnostics(options)

0 commit comments

Comments
 (0)