Skip to content

Commit 47927fd

Browse files
bug: [replace all console messages with applicationLogger] (FF-2552) (#91)
1 parent 86e205c commit 47927fd

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eppo/js-client-sdk",
3-
"version": "3.2.1",
3+
"version": "3.2.2",
44
"description": "Eppo SDK for client-side JavaScript applications",
55
"main": "dist/index.js",
66
"files": [
@@ -58,4 +58,4 @@
5858
"dependencies": {
5959
"@eppo/js-client-sdk-common": "3.3.3"
6060
}
61-
}
61+
}

src/index.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
AttributeType,
1010
ObfuscatedFlag,
1111
ApiEndpoints,
12+
applicationLogger,
1213
} from '@eppo/js-client-sdk-common';
1314

1415
import { assignmentCacheFactory } from './cache/assignment-cache-factory';
@@ -213,7 +214,7 @@ export class EppoJSClient extends EppoClient {
213214

214215
private static getAssignmentInitializationCheck() {
215216
if (!EppoJSClient.initialized) {
216-
console.warn('Eppo SDK assignment requested before init() completed');
217+
applicationLogger.warn('Eppo SDK assignment requested before init() completed');
217218
}
218219
}
219220
}
@@ -268,7 +269,7 @@ export function offlineInit(config: IClientConfigSync): IEppoClient {
268269
});
269270
EppoJSClient.instance.useCustomAssignmentCache(assignmentCache);
270271
} catch (error) {
271-
console.warn(
272+
applicationLogger.warn(
272273
'Eppo SDK encountered an error initializing, assignment calls will return the default value and not be logged',
273274
);
274275
if (throwOnFailedInitialization) {
@@ -355,21 +356,24 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
355356
.then(async () => {
356357
if (!configurationStore.getKeys().length) {
357358
// Consider empty configuration stores invalid
358-
console.warn('Eppo SDK cached configuration is empty');
359+
applicationLogger.warn('Eppo SDK cached configuration is empty');
359360
initFromConfigStoreError = new Error('Configuration store was empty');
360361
return '';
361362
}
362363

363364
const cacheIsExpired = await configurationStore.isExpired();
364365
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');
366367
initFromConfigStoreError = new Error('Configuration store was expired');
367368
return '';
368369
}
369370
return 'config store';
370371
})
371372
.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+
);
373377
initFromConfigStoreError = e;
374378
});
375379
const attemptInitFromFetch = instance
@@ -378,7 +382,7 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
378382
return 'fetch';
379383
})
380384
.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);
382386
// eslint-disable-next-line @typescript-eslint/no-unused-vars
383387
initFromFetchError = e;
384388
});
@@ -406,7 +410,7 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
406410
}
407411

408412
if (initializationError) {
409-
console.warn(
413+
applicationLogger.warn(
410414
'Eppo SDK was unable to initialize with a configuration, assignment calls will return the default value and not be logged' +
411415
(config.pollAfterFailedInitialization
412416
? ' until an experiment configuration is successfully retrieved'

0 commit comments

Comments
 (0)