Why this matters
The goal is to make debugging in production easy without exposing sensitive information. Logging should help you answer:- What went wrong?
- Where did it happen?
- How often does it happen?
What we do in Launch
Launch standardizes logging so that:- Local development logs stay in the console.
- Production logs are sent to Sentry only when enabled.
- Errors are captured with context, not raw secrets.
- User‑initiated cancellations (e.g. auth cancel) are not logged.
Recommended logging patterns
1) Use the logging helpers
Prefer the utilities inapps/mobile/lib/utils/logging.ts:
logInfo(message, error?)logWarn(message, error?)logError(message, error?)
2) Log failures, not normal flows
Log when something fails, not when it succeeds. Example:- ✅ Log: “Apple Sign‑In failed”
- ❌ Don’t log: “Apple Sign‑In cancelled by user”
3) Keep messages short and consistent
Use short, stable messages so issues group cleanly in Sentry:Failed to save onboarding nameGoogle Sign‑In failedStripe products API failed
4) Never log secrets
Don’t log:- API keys
- tokens
- passwords
- raw request/response bodies
stripeKey: setsentryDsn: missing
5) Prefer context over payloads
Log the where and why, not the entire payload: ✅Failed to update profile image❌
Failed to update profile image: { full user object }
Suggested places to log
High‑signal areas where production logs are most useful:- Auth failures (Apple/Google/OTP errors)
- Payments and subscription errors
- File upload failures
- Account deletion failures
- Onboarding save failures (profile setup)
- AI chat failures (share, stream, and provider errors)
- File upload failures (S3 flow, native uploads, multipart errors)
How to extend safely
When adding a new feature:- Use
logErrorfor failures. - Use
logWarnfor recoverable issues. - Avoid logging cancellations or expected user behaviour.
- If you must log sensitive flows, log presence, never values.
Related files
apps/mobile/lib/utils/logging.tsapps/mobile/app/auth/login.tsxapps/mobile/app/onboarding/welcome.tsxapps/mobile/app/auth/verify-email-otp.tsxapps/mobile/app/onboarding/verify-otp.tsxapps/mobile/app/onboarding/push-notifications.tsxapps/mobile/app/ai-chat.tsxapps/api/src/routes/ai-stream.tsapps/mobile/app/payments/revenuecat.tsxapps/mobile/app/payments/superwall.tsxapps/mobile/app/file-uploads/s3.tsxapps/mobile/app/delete-account.tsx