diff options
author | Eric Bailey <git@esb.lol> | 2023-11-04 13:12:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-04 13:12:46 -0500 |
commit | e49a3d8a564b2aa42a8c0e66dfcbae27d096dc26 (patch) | |
tree | f3b498168963bc9b945428f16c309670b18602d4 /src/lib/notifications | |
parent | 46c2564e6531712538e44ee6880fb4bfce612ab9 (diff) | |
parent | 0c76866757367953cc6e7cc8c9ad9fcfdb00a862 (diff) | |
download | voidsky-e49a3d8a564b2aa42a8c0e66dfcbae27d096dc26.tar.zst |
Merge pull request #1813 from bluesky-social/eric/app-903-extract-logger-into-singleton
Add new logger
Diffstat (limited to 'src/lib/notifications')
-rw-r--r-- | src/lib/notifications/notifications.ts | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/lib/notifications/notifications.ts b/src/lib/notifications/notifications.ts index dfc9a42b1..01b0ba935 100644 --- a/src/lib/notifications/notifications.ts +++ b/src/lib/notifications/notifications.ts @@ -30,18 +30,18 @@ export function init(store: RootStoreModel) { appId: 'xyz.blueskyweb.app', }) store.log.debug('Notifications: Sent push token (init)', { - type: token.type, + tokenType: token.type, token: token.data, }) } catch (error) { - store.log.error('Notifications: Failed to set push token', error) + store.log.error('Notifications: Failed to set push token', {error}) } } // listens for new changes to the push token // In rare situations, a push token may be changed by the push notification service while the app is running. When a token is rolled, the old one becomes invalid and sending notifications to it will fail. A push token listener will let you handle this situation gracefully by registering the new token with your backend right away. Notifications.addPushTokenListener(async ({data: t, type}) => { - store.log.debug('Notifications: Push token changed', {t, type}) + store.log.debug('Notifications: Push token changed', {t, tokenType: type}) if (t) { try { await store.agent.api.app.bsky.notification.registerPush({ @@ -51,11 +51,11 @@ export function init(store: RootStoreModel) { appId: 'xyz.blueskyweb.app', }) store.log.debug('Notifications: Sent push token (event)', { - type, + tokenType: type, token: t, }) } catch (error) { - store.log.error('Notifications: Failed to set push token', error) + store.log.error('Notifications: Failed to set push token', {error}) } } }) @@ -63,7 +63,7 @@ export function init(store: RootStoreModel) { // handle notifications that are received, both in the foreground or background Notifications.addNotificationReceivedListener(event => { - store.log.debug('Notifications: received', event) + store.log.debug('Notifications: received', {event}) if (event.request.trigger.type === 'push') { // refresh notifications in the background store.me.notifications.syncQueue() @@ -84,10 +84,9 @@ export function init(store: RootStoreModel) { // handle notifications that are tapped on const sub = Notifications.addNotificationResponseReceivedListener( response => { - store.log.debug( - 'Notifications: response received', - response.actionIdentifier, - ) + store.log.debug('Notifications: response received', { + actionIdentifier: response.actionIdentifier, + }) if ( response.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER ) { |