From 157a9523e8754138c5131803eba0d605e5c24f8a Mon Sep 17 00:00:00 2001 From: Dylan Jeffers Date: Thu, 6 Oct 2022 20:53:39 -0700 Subject: [PATCH] [C-1040] Remove extraneous mobile logs --- .../services/audius-backend/AudiusBackend.ts | 5 ---- .../services/fingerprint/FingerprintClient.ts | 4 --- packages/common/src/utils/timeUtil.ts | 4 +-- packages/mobile/src/components/card/Card.tsx | 1 + packages/mobile/src/notifications.ts | 1 - .../track-screen/TrackScreenDetailsTile.tsx | 4 ++- packages/mobile/src/services/analytics.ts | 5 ---- packages/mobile/src/utils/logging.ts | 27 ------------------- .../web/src/common/store/profile/sagas.js | 1 - 9 files changed, 6 insertions(+), 46 deletions(-) delete mode 100644 packages/mobile/src/utils/logging.ts diff --git a/packages/common/src/services/audius-backend/AudiusBackend.ts b/packages/common/src/services/audius-backend/AudiusBackend.ts index d0fad45347..714174bc09 100644 --- a/packages/common/src/services/audius-backend/AudiusBackend.ts +++ b/packages/common/src/services/audius-backend/AudiusBackend.ts @@ -693,9 +693,6 @@ export const audiusBackend = ({ selectionRequestRetries: getRemoteVar( IntKeys.DISCOVERY_NODE_SELECTION_REQUEST_RETRIES ), - unhealthySlotDiffPlays: getRemoteVar( - IntKeys.DISCOVERY_NODE_MAX_SLOT_DIFF_PLAYS - ), unhealthyBlockDiff: getRemoteVar( IntKeys.DISCOVERY_NODE_MAX_BLOCK_DIFF ) @@ -790,7 +787,6 @@ export const audiusBackend = ({ function getSolanaAudiusDataConfig() { if (!anchorProgramId || !anchorAdminAccount) { - console.warn('Missing solana audius data config') return { error: true } @@ -813,7 +809,6 @@ export const audiusBackend = ({ !ethTokenBridgeAddress || !solTokenBridgeAddress ) { - console.warn('Missing wormhole configs') return { error: true } diff --git a/packages/common/src/services/fingerprint/FingerprintClient.ts b/packages/common/src/services/fingerprint/FingerprintClient.ts index 3c5f1998a4..c676c2164a 100644 --- a/packages/common/src/services/fingerprint/FingerprintClient.ts +++ b/packages/common/src/services/fingerprint/FingerprintClient.ts @@ -44,10 +44,8 @@ export class FingerprintClient { } async init() { - console.log('Initializing Fingerprint client') try { const fp = await this.initFingerprint(this.apiKey, this.endpoint) - console.log(`Fingerprint loaded`) this.fingerprint = fp } catch (e) { console.error(`Error initializing fingerprint client: ${e}`) @@ -74,7 +72,6 @@ export class FingerprintClient { const { count } = await response.json() if (count >= 1) { - console.log('Previously fingerprinted this user<>platform') return } @@ -83,7 +80,6 @@ export class FingerprintClient { linkedId: userId.toString(), tag: { origin: clientOrigin } }) - console.log('Fingerprint identify') } catch (e) { console.error(`Error identifying fingerprint client: ${e}`) } diff --git a/packages/common/src/utils/timeUtil.ts b/packages/common/src/utils/timeUtil.ts index 26d096be6e..715682faff 100644 --- a/packages/common/src/utils/timeUtil.ts +++ b/packages/common/src/utils/timeUtil.ts @@ -20,8 +20,8 @@ export const formatSecondsAsText = (seconds: number): string => { return `${d.minutes()}m ${d.seconds()}s` } -export const formatDate = (date: MomentInput): string => { - return moment(date).format('MM/DD/YY') +export const formatDate = (date: MomentInput, format?: string): string => { + return moment(date, format).format('MM/DD/YY') } export const formatDateWithTimezoneOffset = (date: MomentInput): string => { diff --git a/packages/mobile/src/components/card/Card.tsx b/packages/mobile/src/components/card/Card.tsx index 3812314222..3980adfb5e 100644 --- a/packages/mobile/src/components/card/Card.tsx +++ b/packages/mobile/src/components/card/Card.tsx @@ -70,6 +70,7 @@ type CardImageProps = { const CardImage = ({ id, type, imageSize }: CardImageProps) => { const useImage = type === 'user' ? useUserProfilePicture : useCollectionCoverArt + const image = useImage({ id, sizes: imageSize, diff --git a/packages/mobile/src/notifications.ts b/packages/mobile/src/notifications.ts index 084930f98c..35f7b65b58 100644 --- a/packages/mobile/src/notifications.ts +++ b/packages/mobile/src/notifications.ts @@ -78,7 +78,6 @@ class PushNotifications { } async onRegister(token: Token) { - console.log('REGISTER DEVICE TOKEN', token) this.token = token await AsyncStorage.setItem('@device_token', JSON.stringify(token)) isRegistering = false diff --git a/packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx b/packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx index 0530acaeaf..26e84e214c 100644 --- a/packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx +++ b/packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx @@ -174,7 +174,9 @@ export const TrackScreenDetailsTile = ({ { isHidden: is_unlisted, label: 'Released', - value: formatDate(release_date || created_at) + value: release_date + ? formatDate(release_date, 'ddd MMM DD YYYY HH:mm:ss') + : formatDate(created_at, 'YYYY-MM-DD HH:mm:ss') }, { icon: diff --git a/packages/mobile/src/services/analytics.ts b/packages/mobile/src/services/analytics.ts index 94415510fd..7ed6b0f506 100644 --- a/packages/mobile/src/services/analytics.ts +++ b/packages/mobile/src/services/analytics.ts @@ -12,11 +12,9 @@ const ampInstance = Amplitude.getInstance() export const init = async () => { try { - console.info('Analytics setup') if (AmplitudeWriteKey) { await ampInstance.init(AmplitudeWriteKey) analyticsSetupStatus = 'ready' - console.info('Analytics ready') } else { analyticsSetupStatus = 'error' console.info('Analytics unable to setup: missing amplitude write key') @@ -61,7 +59,6 @@ export const identify = async ( ) => { const isSetup = await isAudiusSetup() if (!isSetup) return - console.info('Analytics identify', handle, traits) ampInstance.setUserId(handle) ampInstance.setUserProperties(traits) } @@ -76,7 +73,6 @@ export const track = async ({ eventName, properties }: Track) => { ...properties, mobileClientVersion: version } - console.info('Analytics track', eventName, propertiesWithContext) ampInstance.logEvent(eventName, propertiesWithContext) } @@ -85,6 +81,5 @@ export const track = async ({ eventName, properties }: Track) => { export const screen = async ({ route, properties = {} }: Screen) => { const isSetup = await isAudiusSetup() if (!isSetup) return - console.info('Analytics screen', route, properties) ampInstance.logEvent(EventNames.PAGE_VIEW, { route, ...properties }) } diff --git a/packages/mobile/src/utils/logging.ts b/packages/mobile/src/utils/logging.ts deleted file mode 100644 index 84352d378f..0000000000 --- a/packages/mobile/src/utils/logging.ts +++ /dev/null @@ -1,27 +0,0 @@ -export type LOG_LEVEL = 'LOG' | 'WARNING' | 'DEBUG' | 'ERROR' - -const formatMessage = (message: string | object) => { - const formatted = - typeof message === 'object' ? JSON.stringify(message) : message - - return `WebApp: ${formatted}` -} - -export const handleWebAppLog = (level: LOG_LEVEL, message: string) => { - const formatted = formatMessage(message) - switch (level) { - case 'LOG': - console.log(formatted) - break - case 'WARNING': - case 'ERROR': - // console.error triggers an exception and an unpreventable - // fullscreen LogBox. Logging web app - // errors as a warning to prevent this - console.warn(formatted) - break - case 'DEBUG': - console.debug(formatted) - break - } -} diff --git a/packages/web/src/common/store/profile/sagas.js b/packages/web/src/common/store/profile/sagas.js index 666278b0d3..fb09435482 100644 --- a/packages/web/src/common/store/profile/sagas.js +++ b/packages/web/src/common/store/profile/sagas.js @@ -93,7 +93,6 @@ function* fetchProfileCustomizedCollectibles(user) { } ]) ) - console.log('something went wrong, could not get user collectibles order') } } }