9
9
AttributeType ,
10
10
ObfuscatedFlag ,
11
11
ApiEndpoints ,
12
+ applicationLogger ,
12
13
} from '@eppo/js-client-sdk-common' ;
13
14
14
15
import { assignmentCacheFactory } from './cache/assignment-cache-factory' ;
@@ -213,7 +214,7 @@ export class EppoJSClient extends EppoClient {
213
214
214
215
private static getAssignmentInitializationCheck ( ) {
215
216
if ( ! EppoJSClient . initialized ) {
216
- console . warn ( 'Eppo SDK assignment requested before init() completed' ) ;
217
+ applicationLogger . warn ( 'Eppo SDK assignment requested before init() completed' ) ;
217
218
}
218
219
}
219
220
}
@@ -268,7 +269,7 @@ export function offlineInit(config: IClientConfigSync): IEppoClient {
268
269
} ) ;
269
270
EppoJSClient . instance . useCustomAssignmentCache ( assignmentCache ) ;
270
271
} catch ( error ) {
271
- console . warn (
272
+ applicationLogger . warn (
272
273
'Eppo SDK encountered an error initializing, assignment calls will return the default value and not be logged' ,
273
274
) ;
274
275
if ( throwOnFailedInitialization ) {
@@ -355,21 +356,24 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
355
356
. then ( async ( ) => {
356
357
if ( ! configurationStore . getKeys ( ) . length ) {
357
358
// Consider empty configuration stores invalid
358
- console . warn ( 'Eppo SDK cached configuration is empty' ) ;
359
+ applicationLogger . warn ( 'Eppo SDK cached configuration is empty' ) ;
359
360
initFromConfigStoreError = new Error ( 'Configuration store was empty' ) ;
360
361
return '' ;
361
362
}
362
363
363
364
const cacheIsExpired = await configurationStore . isExpired ( ) ;
364
365
if ( cacheIsExpired && ! config . useExpiredCache ) {
365
- console . warn ( 'Eppo SDK set not to use expired cached configuration' ) ;
366
+ applicationLogger . warn ( 'Eppo SDK set not to use expired cached configuration' ) ;
366
367
initFromConfigStoreError = new Error ( 'Configuration store was expired' ) ;
367
368
return '' ;
368
369
}
369
370
return 'config store' ;
370
371
} )
371
372
. catch ( ( e ) => {
372
- console . warn ( 'Eppo SDK encountered an error initializing from the configuration store' , e ) ;
373
+ applicationLogger . warn (
374
+ 'Eppo SDK encountered an error initializing from the configuration store' ,
375
+ e ,
376
+ ) ;
373
377
initFromConfigStoreError = e ;
374
378
} ) ;
375
379
const attemptInitFromFetch = instance
@@ -378,7 +382,7 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
378
382
return 'fetch' ;
379
383
} )
380
384
. catch ( ( e ) => {
381
- console . warn ( 'Eppo SDK encountered an error initializing from fetching' , e ) ;
385
+ applicationLogger . warn ( 'Eppo SDK encountered an error initializing from fetching' , e ) ;
382
386
// eslint-disable-next-line @typescript-eslint/no-unused-vars
383
387
initFromFetchError = e ;
384
388
} ) ;
@@ -406,7 +410,7 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
406
410
}
407
411
408
412
if ( initializationError ) {
409
- console . warn (
413
+ applicationLogger . warn (
410
414
'Eppo SDK was unable to initialize with a configuration, assignment calls will return the default value and not be logged' +
411
415
( config . pollAfterFailedInitialization
412
416
? ' until an experiment configuration is successfully retrieved'
0 commit comments