Logging & Debugging
Use the Expo logger safely during development and diagnose API failures.
Built-in logger
The template's lib/logger.ts exposes tagged debug, info, warn, error, and success methods. Every logger method is a no-op when __DEV__ is false, so production builds do not emit these formatted logs.
import { logger } from '@/lib/logger';
const log = logger.create('Profile');
log.info('Loading profile', { uuid });
log.error('Profile request failed', { status });The API client uses this logger to record request paths, response status, durations, and parsed error data in development. Its current request log also receives the assembled request headers/body, so development output can contain a bearer token or PII. Redact those fields before sharing logs or adding new request logging. Never include passwords, bearer tokens, reset tokens, or unnecessary personal data in log payloads.
API debugging
When an Account request fails, check:
EXPO_PUBLIC_API_URLpoints to the host root and is reachable from the device.- The client is adding
/api/v1exactly once. - Laravel is running and the token is valid.
- The Go service, if used, can reach the shared PostgreSQL and Redis services.
- A Guest build is not trying to call an Account-only hook; Guest requests fail closed by design.
A 401 clears the auth store and sends the user back through the auth flow. A Guest ApiError with status 0 means the profile gate worked; it is not a network outage.
React Query inspection
Use React Query Devtools or temporary query-state logging in development when diagnosing stale data, disabled queries, or mutation invalidation. Remove temporary logging before committing.
Crash reporting
The Expo template currently does not install or initialize Sentry or Firebase Crashlytics. Add and configure a crash-reporting service explicitly if the app requires one; do not document it as enabled by default.
Relevant files
lib/logger.ts— formatted development logger.lib/log-middleware.ts— Zustand action logging wrapper.services/api.ts— request/response and error logging.hooks/use-smart-query.ts— query freshness/retry behavior.
