Skip to content

Commit c3f1eed

Browse files
committed
Fix for undefined logger.
1 parent 79ce6a5 commit c3f1eed

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ export const DEFAULT_RETRY_DELAY_MS = 5000;
205205

206206
export const DEFAULT_STREAMING_SYNC_OPTIONS = {
207207
retryDelayMs: DEFAULT_RETRY_DELAY_MS,
208-
logger: Logger.get('PowerSyncStream'),
209208
crudUploadThrottleMs: DEFAULT_CRUD_UPLOAD_THROTTLE_MS
210209
};
211210

@@ -234,6 +233,7 @@ export abstract class AbstractStreamingSyncImplementation
234233
protected abortController: AbortController | null;
235234
protected crudUpdateListener?: () => void;
236235
protected streamingSyncPromise?: Promise<void>;
236+
protected logger: ILogger;
237237

238238
private isUploadingCrud: boolean = false;
239239
private notifyCompletedUploads?: () => void;
@@ -244,6 +244,7 @@ export abstract class AbstractStreamingSyncImplementation
244244
constructor(options: AbstractStreamingSyncImplementationOptions) {
245245
super();
246246
this.options = { ...DEFAULT_STREAMING_SYNC_OPTIONS, ...options };
247+
this.logger = options.logger ?? Logger.get('PowerSyncStream');
247248

248249
this.syncStatus = new SyncStatus({
249250
connected: false,
@@ -318,10 +319,6 @@ export abstract class AbstractStreamingSyncImplementation
318319
return this.syncStatus.connected;
319320
}
320321

321-
protected get logger() {
322-
return this.options.logger!;
323-
}
324-
325322
async dispose() {
326323
this.crudUpdateListener?.();
327324
this.crudUpdateListener = undefined;

packages/node/src/db/PowerSyncDatabase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
7878
connector: PowerSyncBackendConnector,
7979
options: NodeAdditionalConnectionOptions
8080
): AbstractStreamingSyncImplementation {
81-
const logger = this.options.logger;
81+
const logger = this.logger;
8282
const remote = new NodeRemote(connector, logger, {
8383
dispatcher: options.dispatcher,
8484
...(this.options as NodePowerSyncDatabaseOptions).remoteOptions

0 commit comments

Comments
 (0)