From 13f103a3ca7e9a5eafbec7459e43e32db29f3722 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sun, 8 Mar 2026 01:17:00 +0100 Subject: [PATCH] Hide logs in prod --- backend/api/src/get-connection-interests.ts | 2 +- common/src/geodb.ts | 1 - common/src/profiles/og-image.ts | 1 - common/src/util/promise.ts | 4 +++- web/components/add-option-entry.tsx | 3 ++- web/components/email-verification-button.tsx | 3 ++- web/components/profile/connect-actions.tsx | 4 ++-- .../profile/delete-account-survey-modal.tsx | 2 +- web/components/widgets/visibility-observer.tsx | 4 ++-- web/hooks/use-choices.ts | 2 +- web/hooks/use-events.ts | 3 ++- web/hooks/use-profile-draft.ts | 6 +++--- web/hooks/use-user-supabase.ts | 2 +- web/hooks/use-user.ts | 2 +- web/lib/firebase/password.ts | 2 +- web/lib/firebase/users.ts | 13 +++++++------ web/lib/service/android-push.ts | 13 +++++++------ web/lib/service/web-push.ts | 11 ++++++----- web/lib/util/copy.ts | 16 ++++++---------- web/lib/util/page-data.ts | 5 +++-- web/pages/[username]/index.tsx | 2 +- web/pages/_app.tsx | 7 ++++--- web/pages/api/og/profile.tsx | 2 -- web/pages/compatibility.tsx | 11 ++++++----- web/pages/events.tsx | 7 ++++--- web/pages/messages/[channelId].tsx | 2 -- 26 files changed, 66 insertions(+), 64 deletions(-) diff --git a/backend/api/src/get-connection-interests.ts b/backend/api/src/get-connection-interests.ts index 1971fa84..1fd43f38 100644 --- a/backend/api/src/get-connection-interests.ts +++ b/backend/api/src/get-connection-interests.ts @@ -27,7 +27,7 @@ export const getConnectionInterests = async (props: any, userId: string) => { [userId, targetUserId], ) const interests = _interests.map((i: {connection_type: string}) => i.connection_type) ?? [] - console.log({_interests, interests}) + // debug({_interests, interests}) // Get what connection interest they have with me (filtering out the ones I haven't expressed interest in // so it's risk-free to express interest in them) diff --git a/common/src/geodb.ts b/common/src/geodb.ts index cd7d588b..89b29ab6 100644 --- a/common/src/geodb.ts +++ b/common/src/geodb.ts @@ -41,7 +41,6 @@ export function getLocationText( const city = profile[`${prefix}city` as keyof ProfileRow] const country = profile[`${prefix}country` as keyof ProfileRow] const regionCode = profile[`${prefix}region_code` as keyof ProfileRow] - console.log({city, country, regionCode}) const stateOrCountry = country === 'United States of America' ? regionCode : country diff --git a/common/src/profiles/og-image.ts b/common/src/profiles/og-image.ts index da1dd3d0..4e9c9302 100644 --- a/common/src/profiles/og-image.ts +++ b/common/src/profiles/og-image.ts @@ -34,7 +34,6 @@ export function getProfileOgImageUrl( profile?: Profile | null, // choicesIdsToLabels?: Record | null, ) { - console.log({profile}) const headline = profile?.headline || parseJsonContentToText(profile?.bio as JSONContent) || diff --git a/common/src/util/promise.ts b/common/src/util/promise.ts index f40eee38..09165598 100644 --- a/common/src/util/promise.ts +++ b/common/src/util/promise.ts @@ -1,3 +1,5 @@ +import {debug} from 'common/logger' + export type RetryPolicy = { initialBackoffSec: number retries: number @@ -17,7 +19,7 @@ export async function withRetries(q: PromiseLike, policy?: RetryPolicy) { } catch (e) { err = e as Error if (i < maxRetries) { - console.debug(`Error: ${err.message} - Retrying in ${delaySec}s.`) + debug(`Error: ${err.message} - Retrying in ${delaySec}s.`) await delay(delaySec * 1000) delaySec *= 2 } diff --git a/web/components/add-option-entry.tsx b/web/components/add-option-entry.tsx index 7b4c4196..c56fd47f 100644 --- a/web/components/add-option-entry.tsx +++ b/web/components/add-option-entry.tsx @@ -1,4 +1,5 @@ import clsx from 'clsx' +import {debug} from 'common/logger' import {OptionTableKey} from 'common/profiles/constants' import {ProfileWithoutUser} from 'common/profiles/profile' import {invert} from 'lodash' @@ -28,7 +29,7 @@ export function AddOptionEntry(props: { selected={(profile[label] ?? []).map((s) => String(s))} onChange={(selected) => setProfile(label, selected as string[] | undefined)} addOption={(v: string) => { - console.log(`Adding ${label}:`, v) + debug(`Adding ${label}:`, v) setChoices((prev: string[]) => ({...prev, [v]: v})) setProfile(label, [...(profile[label] ?? []), v]) return {key: v, value: v} diff --git a/web/components/email-verification-button.tsx b/web/components/email-verification-button.tsx index a4e9941c..a4bc68e9 100644 --- a/web/components/email-verification-button.tsx +++ b/web/components/email-verification-button.tsx @@ -1,3 +1,4 @@ +import {debug} from 'common/logger' import toast from 'react-hot-toast' import {Button} from 'web/components/buttons/button' import {Col} from 'web/components/layout/col' @@ -20,7 +21,7 @@ export function EmailVerificationButton() { if (firebaseUser.emailVerified) { // IMPORTANT: force a new ID token with updated claims await firebaseUser.getIdToken(true) - console.log('User email verified') + debug('User email verified') return true } else { toast.error(t('settings.email.not_verified', 'Email still not verified...')) diff --git a/web/components/profile/connect-actions.tsx b/web/components/profile/connect-actions.tsx index f046e88a..f7b99aa1 100644 --- a/web/components/profile/connect-actions.tsx +++ b/web/components/profile/connect-actions.tsx @@ -44,7 +44,7 @@ export function ConnectActions(props: {profile: Profile; user: User}) { const result = await api('get-connection-interests', { targetUserId: user.id, }) - console.log('Preferences:', result) + // debug('Preferences:', result) setInterests(result.interests) setTargetInterests(result.targetInterests) } catch (e) { @@ -139,6 +139,7 @@ export function ConnectActions(props: {profile: Profile; user: User}) { return (