Improve Logging (#1519)

Improve Logging

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-09-28 22:06:35 +02:00 committed by GitHub
parent 1172a1d7b8
commit 0e512531a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 361 additions and 92 deletions

View file

@ -12,8 +12,10 @@ import { ShowIf } from '../common/show-if/show-if'
import { IconName } from '../common/fork-awesome/types'
import { dismissUiNotification } from '../../redux/ui-notifications/methods'
import { Trans, useTranslation } from 'react-i18next'
import { Logger } from '../../utils/logger'
const STEPS_PER_SECOND = 10
const log = new Logger('UiNotificationToast')
export interface UiNotificationProps extends UiNotification {
notificationId: number
@ -42,7 +44,7 @@ export const UiNotificationToast: React.FC<UiNotificationProps> = ({
}, [])
const dismissThisNotification = useCallback(() => {
console.debug(`[Notifications] Dismissed notification ${notificationId}`)
log.debug(`Dismissed notification ${notificationId}`)
dismissUiNotification(notificationId)
}, [notificationId])
@ -50,7 +52,7 @@ export const UiNotificationToast: React.FC<UiNotificationProps> = ({
if (dismissed || !!interval.current) {
return
}
console.debug(`[Notifications] Show notification ${notificationId}`)
log.debug(`Show notification ${notificationId}`)
setEta(durationInSecond * STEPS_PER_SECOND)
interval.current = setInterval(
() =>