fix: logs meta
This commit is contained in:
parent
a2b1323568
commit
8ac84c59af
4 changed files with 21 additions and 16 deletions
|
@ -19,7 +19,7 @@ export class AccountDeletionRequestedEventHandler implements DomainEventHandlerI
|
|||
async handle(event: AccountDeletionRequestedEvent): Promise<void> {
|
||||
const userUuidOrError = Uuid.create(event.payload.userUuid)
|
||||
if (userUuidOrError.isFailed()) {
|
||||
this.logger.warn(`Could not find user with uuid: ${event.payload.userUuid}`)
|
||||
this.logger.warn('Could not find user.', { userId: event.payload.userUuid })
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export class AccountDeletionRequestedEventHandler implements DomainEventHandlerI
|
|||
const user = await this.userRepository.findOneByUuid(userUuid)
|
||||
|
||||
if (user === null) {
|
||||
this.logger.warn(`Could not find user with uuid: ${userUuid.value}`)
|
||||
this.logger.warn('Could not find user.', { userId: userUuid.value })
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -37,7 +37,9 @@ export class AccountDeletionRequestedEventHandler implements DomainEventHandlerI
|
|||
|
||||
await this.userRepository.remove(user)
|
||||
|
||||
this.logger.info(`Finished account cleanup for user: ${userUuid.value}`)
|
||||
this.logger.info('Finished account cleanup.', {
|
||||
userId: userUuid.value,
|
||||
})
|
||||
}
|
||||
|
||||
private async removeSessions(userUuid: string): Promise<void> {
|
||||
|
|
|
@ -22,7 +22,7 @@ export class WebSocketsClientService implements ClientServiceInterface {
|
|||
(await user.roles).map((role) => role.name),
|
||||
)
|
||||
|
||||
this.logger.info(`[WebSockets] Requesting message ${event.type} to user ${user.uuid}`)
|
||||
this.logger.debug(`[WebSockets] Requesting message ${event.type} to user ${user.uuid}`)
|
||||
|
||||
await this.domainEventPublisher.publish(
|
||||
this.domainEventFactory.createWebSocketMessageRequestedEvent({
|
||||
|
|
|
@ -12,7 +12,7 @@ export class AccountDeletionRequestedEventHandler implements DomainEventHandlerI
|
|||
async handle(event: AccountDeletionRequestedEvent): Promise<void> {
|
||||
const userUuidOrError = Uuid.create(event.payload.userUuid)
|
||||
if (userUuidOrError.isFailed()) {
|
||||
this.logger.warn(`Failed account cleanup: ${userUuidOrError.getError()}`)
|
||||
this.logger.warn(`Failed account cleanup: ${userUuidOrError.getError()}`, { userId: event.payload.userUuid })
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -20,6 +20,6 @@ export class AccountDeletionRequestedEventHandler implements DomainEventHandlerI
|
|||
|
||||
await this.revisionRepository.removeByUserUuid(userUuid)
|
||||
|
||||
this.logger.info(`Finished account cleanup for user: ${event.payload.userUuid}`)
|
||||
this.logger.info('Finished account cleanup.', { userId: event.payload.userUuid })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,10 @@ export class AccountDeletionRequestedEventHandler implements DomainEventHandlerI
|
|||
async handle(event: AccountDeletionRequestedEvent): Promise<void> {
|
||||
const userUuidOrError = Uuid.create(event.payload.userUuid)
|
||||
if (userUuidOrError.isFailed()) {
|
||||
this.logger.error(`AccountDeletionRequestedEventHandler failed: ${userUuidOrError.getError()}`)
|
||||
this.logger.error(userUuidOrError.getError(), {
|
||||
userId: event.payload.userUuid,
|
||||
codeTag: 'AccountDeletionRequestedEventHandler',
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -30,9 +33,9 @@ export class AccountDeletionRequestedEventHandler implements DomainEventHandlerI
|
|||
allowSurviving: true,
|
||||
})
|
||||
if (deletingVaultsResult.isFailed()) {
|
||||
this.logger.error(
|
||||
`Failed to delete shared vaults for user: ${event.payload.userUuid}: ${deletingVaultsResult.getError()}`,
|
||||
)
|
||||
this.logger.error(`Failed to delete shared vaults: ${deletingVaultsResult.getError()}`, {
|
||||
userId: event.payload.userUuid,
|
||||
})
|
||||
}
|
||||
|
||||
const deletedSharedVaultUuids = Array.from(deletingVaultsResult.getValue().keys())
|
||||
|
@ -49,13 +52,13 @@ export class AccountDeletionRequestedEventHandler implements DomainEventHandlerI
|
|||
userUuid: event.payload.userUuid,
|
||||
})
|
||||
if (deletingUserFromOtherVaultsResult.isFailed()) {
|
||||
this.logger.error(
|
||||
`Failed to remove user: ${
|
||||
event.payload.userUuid
|
||||
} from shared vaults: ${deletingUserFromOtherVaultsResult.getError()}`,
|
||||
)
|
||||
this.logger.error(`Failed to remove user from shared vaults: ${deletingUserFromOtherVaultsResult.getError()}`, {
|
||||
userId: event.payload.userUuid,
|
||||
})
|
||||
}
|
||||
|
||||
this.logger.info(`Finished account cleanup for user: ${event.payload.userUuid}`)
|
||||
this.logger.info('Finished account cleanup', {
|
||||
userId: event.payload.userUuid,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue