Replace all logs with new logger

This commit is contained in:
Eric Bailey 2023-11-04 13:42:36 -05:00
parent e49a3d8a56
commit f51351e80d
66 changed files with 301 additions and 230 deletions

View file

@ -2,6 +2,7 @@ import * as Updates from 'expo-updates'
import {useCallback, useEffect} from 'react'
import {AppState} from 'react-native'
import {useStores} from 'state/index'
import {logger} from '#/logger'
export function useOTAUpdate() {
const store = useStores()
@ -21,7 +22,7 @@ export function useOTAUpdate() {
})
}, [store.shell])
const checkForUpdate = useCallback(async () => {
store.log.debug('useOTAUpdate: Checking for update...')
logger.debug('useOTAUpdate: Checking for update...')
try {
// Check if new OTA update is available
const update = await Updates.checkForUpdateAsync()
@ -34,16 +35,16 @@ export function useOTAUpdate() {
// show a popup modal
showUpdatePopup()
} catch (e) {
store.log.error('useOTAUpdate: Error while checking for update', {
logger.error('useOTAUpdate: Error while checking for update', {
error: e,
})
}
}, [showUpdatePopup, store.log])
}, [showUpdatePopup])
const updateEventListener = useCallback(
(event: Updates.UpdateEvent) => {
store.log.debug('useOTAUpdate: Listening for update...')
logger.debug('useOTAUpdate: Listening for update...')
if (event.type === Updates.UpdateEventType.ERROR) {
store.log.error('useOTAUpdate: Error while listening for update', {
logger.error('useOTAUpdate: Error while listening for update', {
message: event.message,
})
} else if (event.type === Updates.UpdateEventType.NO_UPDATE_AVAILABLE) {
@ -55,7 +56,7 @@ export function useOTAUpdate() {
showUpdatePopup()
}
},
[showUpdatePopup, store.log],
[showUpdatePopup],
)
useEffect(() => {