Replace all logs with new logger
This commit is contained in:
parent
e49a3d8a56
commit
f51351e80d
66 changed files with 301 additions and 230 deletions
|
@ -21,6 +21,7 @@ import {useFocusEffect} from '@react-navigation/native'
|
|||
import {ViewHeader} from '../com/util/ViewHeader'
|
||||
import {CenteredView} from 'view/com/util/Views'
|
||||
import {ProfileCard} from 'view/com/profile/ProfileCard'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
type Props = NativeStackScreenProps<
|
||||
CommonNavigatorParams,
|
||||
|
@ -52,9 +53,9 @@ export const ModerationBlockedAccounts = withAuthRequired(
|
|||
blockedAccounts
|
||||
.loadMore()
|
||||
.catch(err =>
|
||||
store.log.error('Failed to load more blocked accounts', {error: err}),
|
||||
logger.error('Failed to load more blocked accounts', {error: err}),
|
||||
)
|
||||
}, [blockedAccounts, store])
|
||||
}, [blockedAccounts])
|
||||
|
||||
const renderItem = ({
|
||||
item,
|
||||
|
|
|
@ -21,6 +21,7 @@ import {useFocusEffect} from '@react-navigation/native'
|
|||
import {ViewHeader} from '../com/util/ViewHeader'
|
||||
import {CenteredView} from 'view/com/util/Views'
|
||||
import {ProfileCard} from 'view/com/profile/ProfileCard'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
type Props = NativeStackScreenProps<
|
||||
CommonNavigatorParams,
|
||||
|
@ -49,9 +50,9 @@ export const ModerationMutedAccounts = withAuthRequired(
|
|||
mutedAccounts
|
||||
.loadMore()
|
||||
.catch(err =>
|
||||
store.log.error('Failed to load more muted accounts', {error: err}),
|
||||
logger.error('Failed to load more muted accounts', {error: err}),
|
||||
)
|
||||
}, [mutedAccounts, store])
|
||||
}, [mutedAccounts])
|
||||
|
||||
const renderItem = ({
|
||||
item,
|
||||
|
|
|
@ -20,6 +20,7 @@ import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
|||
import {s, colors} from 'lib/styles'
|
||||
import {useAnalytics} from 'lib/analytics/analytics'
|
||||
import {isWeb} from 'platform/detection'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
type Props = NativeStackScreenProps<
|
||||
NotificationsTabNavigatorParams,
|
||||
|
@ -60,7 +61,7 @@ export const NotificationsScreen = withAuthRequired(
|
|||
useFocusEffect(
|
||||
React.useCallback(() => {
|
||||
store.shell.setMinimalShellMode(false)
|
||||
store.log.debug('NotificationsScreen: Updating feed')
|
||||
logger.debug('NotificationsScreen: Updating feed')
|
||||
const softResetSub = store.onScreenSoftReset(onPressLoadLatest)
|
||||
store.me.notifications.update()
|
||||
screen('Notifications')
|
||||
|
|
|
@ -14,6 +14,7 @@ import {s} from 'lib/styles'
|
|||
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||
import {clamp} from 'lodash'
|
||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
const SHELL_FOOTER_HEIGHT = 44
|
||||
|
||||
|
@ -38,7 +39,7 @@ export const PostThreadScreen = withAuthRequired(
|
|||
InteractionManager.runAfterInteractions(() => {
|
||||
if (!view.hasLoaded && !view.isLoading) {
|
||||
view.setup().catch(err => {
|
||||
store.log.error('Failed to fetch thread', {error: err})
|
||||
logger.error('Failed to fetch thread', {error: err})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -29,6 +29,7 @@ import {FeedSourceCard} from 'view/com/feeds/FeedSourceCard'
|
|||
import {FeedSourceModel} from 'state/models/content/feed-source'
|
||||
import {useSetTitle} from 'lib/hooks/useSetTitle'
|
||||
import {combinedDisplayName} from 'lib/strings/display-names'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
type Props = NativeStackScreenProps<CommonNavigatorParams, 'Profile'>
|
||||
export const ProfileScreen = withAuthRequired(
|
||||
|
@ -108,16 +109,16 @@ export const ProfileScreen = withAuthRequired(
|
|||
uiState
|
||||
.refresh()
|
||||
.catch((err: any) =>
|
||||
store.log.error('Failed to refresh user profile', {error: err}),
|
||||
logger.error('Failed to refresh user profile', {error: err}),
|
||||
)
|
||||
}, [uiState, store])
|
||||
}, [uiState])
|
||||
const onEndReached = React.useCallback(() => {
|
||||
uiState.loadMore().catch((err: any) =>
|
||||
store.log.error('Failed to load more entries in user profile', {
|
||||
logger.error('Failed to load more entries in user profile', {
|
||||
error: err,
|
||||
}),
|
||||
)
|
||||
}, [uiState, store])
|
||||
}, [uiState])
|
||||
const onPressTryAgain = React.useCallback(() => {
|
||||
uiState.setup()
|
||||
}, [uiState])
|
||||
|
|
|
@ -40,6 +40,7 @@ import {NavigationProp} from 'lib/routes/types'
|
|||
import {sanitizeHandle} from 'lib/strings/handles'
|
||||
import {makeProfileLink} from 'lib/routes/links'
|
||||
import {ComposeIcon2} from 'lib/icons'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
const SECTION_TITLES = ['Posts', 'About']
|
||||
|
||||
|
@ -165,9 +166,9 @@ export const ProfileFeedScreenInner = observer(
|
|||
Toast.show(
|
||||
'There was an an issue updating your feeds, please check your internet connection and try again.',
|
||||
)
|
||||
store.log.error('Failed up update feeds', {error: err})
|
||||
logger.error('Failed up update feeds', {error: err})
|
||||
}
|
||||
}, [store, feedInfo])
|
||||
}, [feedInfo])
|
||||
|
||||
const onToggleLiked = React.useCallback(async () => {
|
||||
Haptics.default()
|
||||
|
@ -181,19 +182,19 @@ export const ProfileFeedScreenInner = observer(
|
|||
Toast.show(
|
||||
'There was an an issue contacting the server, please check your internet connection and try again.',
|
||||
)
|
||||
store.log.error('Failed up toggle like', {error: err})
|
||||
logger.error('Failed up toggle like', {error: err})
|
||||
}
|
||||
}, [store, feedInfo])
|
||||
}, [feedInfo])
|
||||
|
||||
const onTogglePinned = React.useCallback(async () => {
|
||||
Haptics.default()
|
||||
if (feedInfo) {
|
||||
feedInfo.togglePin().catch(e => {
|
||||
Toast.show('There was an issue contacting the server')
|
||||
store.log.error('Failed to toggle pinned feed', {error: e})
|
||||
logger.error('Failed to toggle pinned feed', {error: e})
|
||||
})
|
||||
}
|
||||
}, [store, feedInfo])
|
||||
}, [feedInfo])
|
||||
|
||||
const onPressShare = React.useCallback(() => {
|
||||
const url = toShareUrl(`/profile/${handleOrDid}/feed/${rkey}`)
|
||||
|
|
|
@ -43,6 +43,7 @@ import {sanitizeHandle} from 'lib/strings/handles'
|
|||
import {makeProfileLink, makeListLink} from 'lib/routes/links'
|
||||
import {ComposeIcon2} from 'lib/icons'
|
||||
import {ListItems} from 'view/com/lists/ListItems'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
const SECTION_TITLES_CURATE = ['Posts', 'About']
|
||||
const SECTION_TITLES_MOD = ['About']
|
||||
|
@ -272,9 +273,9 @@ const Header = observer(function HeaderImpl({
|
|||
Haptics.default()
|
||||
list.togglePin().catch(e => {
|
||||
Toast.show('There was an issue contacting the server')
|
||||
store.log.error('Failed to toggle pinned list', {error: e})
|
||||
logger.error('Failed to toggle pinned list', {error: e})
|
||||
})
|
||||
}, [store, list])
|
||||
}, [list])
|
||||
|
||||
const onSubscribeMute = useCallback(() => {
|
||||
store.shell.openModal({
|
||||
|
|
|
@ -26,6 +26,7 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
|||
import * as Toast from 'view/com/util/Toast'
|
||||
import {Haptics} from 'lib/haptics'
|
||||
import {TextLink} from 'view/com/util/Link'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
const HITSLOP_TOP = {
|
||||
top: 20,
|
||||
|
@ -159,31 +160,30 @@ const ListItem = observer(function ListItemImpl({
|
|||
item: FeedSourceModel
|
||||
}) {
|
||||
const pal = usePalette('default')
|
||||
const store = useStores()
|
||||
const isPinned = item.isPinned
|
||||
|
||||
const onTogglePinned = useCallback(() => {
|
||||
Haptics.default()
|
||||
item.togglePin().catch(e => {
|
||||
Toast.show('There was an issue contacting the server')
|
||||
store.log.error('Failed to toggle pinned feed', {error: e})
|
||||
logger.error('Failed to toggle pinned feed', {error: e})
|
||||
})
|
||||
}, [item, store])
|
||||
}, [item])
|
||||
const onPressUp = useCallback(
|
||||
() =>
|
||||
savedFeeds.movePinnedFeed(item, 'up').catch(e => {
|
||||
Toast.show('There was an issue contacting the server')
|
||||
store.log.error('Failed to set pinned feed order', {error: e})
|
||||
logger.error('Failed to set pinned feed order', {error: e})
|
||||
}),
|
||||
[store, savedFeeds, item],
|
||||
[savedFeeds, item],
|
||||
)
|
||||
const onPressDown = useCallback(
|
||||
() =>
|
||||
savedFeeds.movePinnedFeed(item, 'down').catch(e => {
|
||||
Toast.show('There was an issue contacting the server')
|
||||
store.log.error('Failed to set pinned feed order', {error: e})
|
||||
logger.error('Failed to set pinned feed order', {error: e})
|
||||
}),
|
||||
[store, savedFeeds, item],
|
||||
[savedFeeds, item],
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
@ -45,6 +45,7 @@ import {formatCount} from 'view/com/util/numeric/format'
|
|||
import Clipboard from '@react-native-clipboard/clipboard'
|
||||
import {makeProfileLink} from 'lib/routes/links'
|
||||
import {AccountDropdownBtn} from 'view/com/util/AccountDropdownBtn'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
// TEMPORARY (APP-700)
|
||||
// remove after backend testing finishes
|
||||
|
@ -110,10 +111,9 @@ export const SettingsScreen = withAuthRequired(
|
|||
Toast.show('Your handle has been updated')
|
||||
},
|
||||
err => {
|
||||
store.log.error(
|
||||
'Failed to reload from server after handle update',
|
||||
{error: err},
|
||||
)
|
||||
logger.error('Failed to reload from server after handle update', {
|
||||
error: err,
|
||||
})
|
||||
setIsSwitching(false)
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue