Mobile Logging
Purpose
Plan logging: structured, level-based logs with different dev/production behavior, and strict exclusion of secrets/PII — useful for debugging without leaking or bloating.
When to Use
- When the app needs diagnostic logging or before production hardening.
- Not for user-facing error UX (that's
mobile-error-handling).
Inputs
- Diagnostic needs and log destinations.
- Sensitivity of the data involved.
Discovery Questions
- What needs logging (events, errors, performance)?
- What levels, and how do dev vs production differ?
- Where do logs go (console, remote, crash reporter)?
- What must never be logged (tokens, PII)?
Responsibilities
- Define log levels and a structured format.
- Differentiate dev vs production (verbose dev; minimal, safe prod).
- Exclude secrets/PII from all logs (
../../security-review).
- Route logs appropriately (console/remote) without noise.
Required Workflow
- Define what/when to log + levels.
- Set dev vs production behavior.
- Add redaction so no secrets/PII are logged.
- Route logs to destinations.
- Record the logging plan.
Decision Rules
- Never log tokens, passwords, or PII — redact.
- Production logging is minimal and safe; verbose logging is dev-only.
- Structured, level-based logs over scattered console noise.
- Strip debug logs from production paths.
Rules
- No secrets/PII in logs, ever.
- Different dev vs production verbosity.
- Coordinate with error handling + reporting.
Anti-Patterns
- Logging tokens/PII.
- Verbose console noise in production.
- Unstructured, unleveled logs.
- Debug logs shipped to production.
Validation Checklist
Definition of Done
A recorded logging plan: structured level-based logging, distinct dev/production behavior, PII/secret exclusion, and clean routing — helpful for debugging without leaking or bloating.
Related Skills
mobile-error-handling, ../../security-review, mobile-environment-config
Related Knowledge
../../../knowledge/ (diagnostic needs).
Related References
../../../references/mobile/native/ when populated.
Context Loading Guidance
- Requires: diagnostic needs, log destinations, data sensitivity.
- Does not require: unrelated screens, the full mobile skill set, unrelated references.
- May load:
mobile-error-handling, ../../security-review.
- Stop when: the logging plan is recorded.
Token Efficiency Guidance
Keep it to levels, dev/prod behavior, and redaction rules.
1---2name: mobile-logging3description: Use to plan logging — structured, level-based logging, dev vs production behavior, and strict exclusion of secrets/PII. Logs aid debugging without leaking sensitive data or bloating production.4---56# Mobile Logging78## Purpose910Plan logging: structured, level-based logs with different dev/production behavior, and strict exclusion of secrets/PII — useful for debugging without leaking or bloating.1112## When to Use1314- When the app needs diagnostic logging or before production hardening.15- Not for user-facing error UX (that's `mobile-error-handling`).1617## Inputs1819- Diagnostic needs and log destinations.20- Sensitivity of the data involved.2122## Discovery Questions2324- What needs logging (events, errors, performance)?25- What levels, and how do dev vs production differ?26- Where do logs go (console, remote, crash reporter)?27- What must never be logged (tokens, PII)?2829## Responsibilities3031- Define **log levels** and a structured format.32- Differentiate **dev vs production** (verbose dev; minimal, safe prod).33- **Exclude secrets/PII** from all logs (`../../security-review`).34- Route logs appropriately (console/remote) without noise.3536## Required Workflow37381. Define what/when to log + levels.392. Set dev vs production behavior.403. Add redaction so no secrets/PII are logged.414. Route logs to destinations.425. Record the logging plan.4344## Decision Rules4546- Never log tokens, passwords, or PII — redact.47- Production logging is minimal and safe; verbose logging is dev-only.48- Structured, level-based logs over scattered console noise.49- Strip debug logs from production paths.5051## Rules5253- No secrets/PII in logs, ever.54- Different dev vs production verbosity.55- Coordinate with error handling + reporting.5657## Anti-Patterns5859- Logging tokens/PII.60- Verbose console noise in production.61- Unstructured, unleveled logs.62- Debug logs shipped to production.6364## Validation Checklist6566- [ ] Levels + structured format defined.67- [ ] Dev vs production behavior set.68- [ ] Secrets/PII excluded (redaction).69- [ ] Destinations routed.70- [ ] No debug logs in production.7172## Definition of Done7374A recorded logging plan: structured level-based logging, distinct dev/production behavior, PII/secret exclusion, and clean routing — helpful for debugging without leaking or bloating.7576## Related Skills7778`mobile-error-handling`, `../../security-review`, `mobile-environment-config`7980## Related Knowledge8182`../../../knowledge/` (diagnostic needs).8384## Related References8586`../../../references/mobile/native/` when populated.8788## Context Loading Guidance8990- **Requires:** diagnostic needs, log destinations, data sensitivity.91- **Does not require:** unrelated screens, the full mobile skill set, unrelated references.92- **May load:** `mobile-error-handling`, `../../security-review`.93- **Stop when:** the logging plan is recorded.9495## Token Efficiency Guidance9697Keep it to levels, dev/prod behavior, and redaction rules.