Skip to content

Commit e8d4297

Browse files
committed
add prefix to log methods
1 parent 66cbdb8 commit e8d4297

67 files changed

Lines changed: 291 additions & 289 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

__test__/unit/push/registerForPush.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('Register for push', () => {
3131
expect(spy).not.toHaveBeenCalled();
3232
OneSignalEvent.trigger(OneSignal.EVENTS.SDK_INITIALIZED);
3333
await promise;
34-
expect(Log.error).toHaveBeenCalled();
34+
expect(Log._error).toHaveBeenCalled();
3535
expect(OneSignal.initialized).toBe(true);
3636
expect(spy).toHaveBeenCalledTimes(1);
3737
});
@@ -42,7 +42,7 @@ describe('Register for push', () => {
4242
(global as any).OneSignal._initCalled = false;
4343

4444
await InitHelper.registerForPushNotifications();
45-
expect(Log.error).toHaveBeenCalled();
45+
expect(Log._error).toHaveBeenCalled();
4646
expect(spy).toHaveBeenCalledTimes(1);
4747
});
4848
});

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@
8484
},
8585
{
8686
"path": "./build/releases/OneSignalSDK.page.es6.js",
87-
"limit": "51.964 kB",
87+
"limit": "51.91 kB",
8888
"gzip": true
8989
},
9090
{
9191
"path": "./build/releases/OneSignalSDK.sw.js",
92-
"limit": "14.07 kB",
92+
"limit": "14.04 kB",
9393
"gzip": true
9494
},
9595
{

src/core/executors/CustomEventOperationExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class CustomEventsOperationExecutor implements IOperationExecutor {
3434
}
3535

3636
async execute(operations: Operation[]): Promise<ExecutionResponse> {
37-
Log.debug(
37+
Log._debug(
3838
`CustomEventsOperationExecutor(operations: ${JSON.stringify(
3939
operations,
4040
)})`,

src/core/executors/IdentityOperationExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class IdentityOperationExecutor implements IOperationExecutor {
4040
}
4141

4242
async execute(operations: Operation[]): Promise<ExecutionResponse> {
43-
Log.debug(
43+
Log._debug(
4444
`IdentityOperationExecutor(operations: ${JSON.stringify(operations)})`,
4545
);
4646

src/core/executors/LoginUserOperationExecutor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class LoginUserOperationExecutor implements IOperationExecutor {
6262
}
6363

6464
async execute(operations: Operation[]): Promise<ExecutionResponse> {
65-
Log.debug(
65+
Log._debug(
6666
`LoginUserOperationExecutor(operation: ${JSON.stringify(operations)})`,
6767
);
6868
const startingOp = operations[0];
@@ -124,11 +124,11 @@ export class LoginUserOperationExecutor implements IOperationExecutor {
124124
}
125125

126126
case ExecutionResult.FAIL_CONFLICT:
127-
Log.debug(`Handling 409 for externalId: ${loginUserOp.externalId}`);
127+
Log._debug(`Handling 409 for externalId: ${loginUserOp.externalId}`);
128128
return this.createUser(loginUserOp, operations);
129129

130130
case ExecutionResult.FAIL_NORETRY:
131-
Log.error(
131+
Log._error(
132132
`Recovering from SetAlias failure for externalId: ${loginUserOp.externalId}`,
133133
);
134134
return this.createUser(loginUserOp, operations);

src/core/executors/RefreshUserOperationExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class RefreshUserOperationExecutor implements IOperationExecutor {
5252
}
5353

5454
async execute(operations: Operation[]): Promise<ExecutionResponse> {
55-
Log.debug(
55+
Log._debug(
5656
`RefreshUserOperationExecutor(operation: ${JSON.stringify(operations)})`,
5757
);
5858

src/core/executors/SubscriptionOperationExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class SubscriptionOperationExecutor implements IOperationExecutor {
5353
}
5454

5555
async execute(operations: Operation[]): Promise<ExecutionResponse> {
56-
Log.debug(`SubscriptionOperationExecutor(operations: ${operations})`);
56+
Log._debug(`SubscriptionOperationExecutor(operations: ${operations})`);
5757

5858
const startingOp = operations[0];
5959
if (startingOp instanceof CreateSubscriptionOperation)

src/core/executors/UpdateUserOperationExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class UpdateUserOperationExecutor implements IOperationExecutor {
7373
}
7474

7575
async execute(operations: Operation[]): Promise<ExecutionResponse> {
76-
Log.debug(`UpdateUserOperationExecutor(operation: ${operations})`);
76+
Log._debug(`UpdateUserOperationExecutor(operation: ${operations})`);
7777

7878
const { appId, onesignalId, propertiesObject, refreshDeviceMetadata } =
7979
this.processOperations(operations);

src/core/modelRepo/OperationModelStore.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class OperationModelStore extends ModelStore<Operation> {
2727

2828
create(jsonObject?: { name?: string } | null): Operation | null {
2929
if (jsonObject === null) {
30-
Log.error('null jsonObject sent to OperationModelStore.create');
30+
Log._error('null jsonObject sent to OperationModelStore.create');
3131
return null;
3232
}
3333

@@ -96,15 +96,15 @@ export class OperationModelStore extends ModelStore<Operation> {
9696
} {
9797
const operationName = object?.name;
9898
if (!operationName) {
99-
Log.error("jsonObject must have 'name' attribute");
99+
Log._error("jsonObject must have 'name' attribute");
100100
return false;
101101
}
102102

103103
const excluded = new Set<string>([OPERATION_NAME.LOGIN_USER]);
104104

105105
// Must have onesignalId if it is not one of the excluded operations above
106106
if (!object.onesignalId && !excluded.has(operationName)) {
107-
Log.error(
107+
Log._error(
108108
`${operationName} jsonObject must have 'onesignalId' attribute`,
109109
);
110110
return false;

src/core/operationRepo/OperationRepo.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
import { NewRecordsState } from './NewRecordsState';
2222
import { OperationQueueItem, OperationRepo } from './OperationRepo';
2323

24-
vi.spyOn(Log, 'error').mockImplementation((msg) => {
24+
vi.spyOn(Log, '_error').mockImplementation((msg) => {
2525
if (typeof msg === 'string' && msg.includes('Operation execution failed'))
2626
return '';
2727
return msg;

0 commit comments

Comments
 (0)