1010 *
1111 * @packageDocumentation
1212 */
13- import {
14- AutoEnvAttributes ,
15- BasicLogger ,
16- BasicLoggerOptions ,
17- EvaluationSeriesContext ,
18- EvaluationSeriesData ,
19- Hook ,
20- HookMetadata ,
21- IdentifySeriesContext ,
22- IdentifySeriesData ,
23- IdentifySeriesResult ,
24- IdentifySeriesStatus ,
25- LDContext ,
26- LDContextCommon ,
27- LDContextMeta ,
28- LDEvaluationDetail ,
29- LDEvaluationDetailTyped ,
30- LDEvaluationReason ,
31- LDFlagSet ,
32- LDInspection ,
33- LDLogger ,
34- LDLogLevel ,
35- LDMultiKindContext ,
36- LDSingleKindContext ,
37- } from '@launchdarkly/js-client-sdk-common' ;
13+ import { AutoEnvAttributes } from '@launchdarkly/js-client-sdk-common' ;
3814
39- // The exported LDClient and LDOptions are the browser specific implementations.
40- // These shadow the common implementations.
4115import { BrowserClient , LDClient } from './BrowserClient' ;
42- import { BrowserIdentifyOptions as LDIdentifyOptions } from './BrowserIdentifyOptions' ;
43- import { BrowserOptions as LDOptions } from './options' ;
16+ import { LDOptions } from './common' ;
4417
45- export type {
46- LDClient ,
47- LDFlagSet ,
48- LDContext ,
49- LDContextCommon ,
50- LDContextMeta ,
51- LDMultiKindContext ,
52- LDSingleKindContext ,
53- LDLogLevel ,
54- LDLogger ,
55- LDOptions ,
56- LDEvaluationDetail ,
57- LDEvaluationDetailTyped ,
58- LDEvaluationReason ,
59- LDIdentifyOptions ,
60- Hook ,
61- HookMetadata ,
62- EvaluationSeriesContext ,
63- EvaluationSeriesData ,
64- IdentifySeriesContext ,
65- IdentifySeriesData ,
66- IdentifySeriesResult ,
67- IdentifySeriesStatus ,
68- LDInspection ,
69- } ;
18+ export * from './common' ;
19+ export type { LDClient } ;
7020
7121/**
7222 * Creates an instance of the LaunchDarkly client.
@@ -88,55 +38,3 @@ export function initialize(clientSideId: string, options?: LDOptions): LDClient
8838 // AutoEnvAttributes are not supported yet in the browser SDK.
8939 return new BrowserClient ( clientSideId , AutoEnvAttributes . Disabled , options ) ;
9040}
91-
92- /**
93- * Provides a basic {@link LDLogger} implementation.
94- *
95- * This logging implementation uses a basic format that includes only the log level
96- * and the message text. By default this uses log level 'info' and the output is
97- * written to `console.error`.
98- *
99- * To use the logger created by this function, put it into {@link LDOptions.logger}. If
100- * you do not set {@link LDOptions.logger} to anything, the SDK uses a default logger
101- * that will log "info" level and higher priorty messages and it will log messages to
102- * console.info, console.warn, and console.error.
103- *
104- * @param options Configuration for the logger. If no options are specified, the
105- * logger uses `{ level: 'info' }`.
106- *
107- * @example
108- * This example shows how to use `basicLogger` in your SDK options to enable console
109- * logging only at `warn` and `error` levels.
110- * ```javascript
111- * const ldOptions = {
112- * logger: basicLogger({ level: 'warn' }),
113- * };
114- * ```
115- *
116- * @example
117- * This example shows how to use `basicLogger` in your SDK options to cause all
118- * log output to go to `console.log`
119- * ```javascript
120- * const ldOptions = {
121- * logger: basicLogger({ destination: console.log }),
122- * };
123- * ```
124- *
125- * * @example
126- * The configuration also allows you to control the destination for each log level.
127- * ```javascript
128- * const ldOptions = {
129- * logger: basicLogger({
130- * destination: {
131- * debug: console.debug,
132- * info: console.info,
133- * warn: console.warn,
134- * error:console.error
135- * }
136- * }),
137- * };
138- * ```
139- */
140- export function basicLogger ( options : BasicLoggerOptions ) : LDLogger {
141- return new BasicLogger ( options ) ;
142- }
0 commit comments