fix: include uuid in iframe communicator logger

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-09-28 15:40:16 +02:00
parent 865e127d16
commit d5455f7c33
5 changed files with 27 additions and 12 deletions

View file

@ -19,7 +19,7 @@ export class EditorToRendererCommunicator extends WindowPostMessageCommunicator<
EditorToRendererMessageType,
CommunicationMessages
> {
protected createLogger(): Logger {
return new Logger('EditorToRendererCommunicator')
protected createLogger(uuid: string): Logger {
return new Logger(`EditorToRendererCommunicator[${uuid}]`)
}
}

View file

@ -19,7 +19,7 @@ export class RendererToEditorCommunicator extends WindowPostMessageCommunicator<
RendererToEditorMessageType,
CommunicationMessages
> {
protected createLogger(): Logger {
return new Logger('RendererToEditorCommunicator')
protected createLogger(uuid: string): Logger {
return new Logger(`RendererToEditorCommunicator[${uuid}]`)
}
}

View file

@ -45,14 +45,14 @@ export abstract class WindowPostMessageCommunicator<
) {
this.boundListener = this.handleEvent.bind(this)
this.communicationEnabled = false
this.log = this.createLogger()
this.log = this.createLogger(uuid)
}
public getUuid(): string {
return this.uuid
}
protected abstract createLogger(): Logger
protected abstract createLogger(uuid: string): Logger
/**
* Registers the event listener on the current global {@link window}.