You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Optimized to complete in **under 90 seconds** using caching
151
+
- Required for branch protection — PRs cannot be merged if it fails
152
+
- Run checks locally before pushing to avoid CI failures
153
+
154
+
## Architecture
155
+
156
+
The intended module structure, layering and dependency direction are documented
157
+
in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). The layering is enforced locally
158
+
and in CI with dependency-cruiser:
159
+
160
+
```bash
161
+
npm run architecture:check
162
+
```
163
+
164
+
Read the architecture doc before adding a new module — the codebase already has
165
+
a single canonical implementation for error handling, logging, location, course
166
+
progress, sync conflict resolution, and feature flags, and duplicating one of
167
+
these is a review blocker.
168
+
169
+
## Structured Logging
170
+
171
+
**Never use `console.*` in `src/`.** The ESLint `no-console` rule is set to `error`, and CI will fail if any `console.*` call is introduced. Use `src/utils/logger` instead.
172
+
173
+
### Why structured logging?
174
+
175
+
`console.log` output is unstructured, always-on, and leaks information in production builds. `logger` gives you:
176
+
- Log level filtering (only `error` and `warn` in production)
- A single place to redirect logs to remote monitoring (e.g. Sentry, Datadog)
179
+
180
+
### Log level guide
181
+
182
+
| Level | Method | When to use |
183
+
|---|---|---|
184
+
|**error**|`logger.error(msg, err?)`| Unexpected failures that need immediate attention. Always include the `Error` object as the second argument. |
185
+
|**warn**|`logger.warn(msg, ctx?)`| Recoverable issues or deprecated code paths that should be investigated. |
186
+
|**info**|`logger.info(msg, ctx?)`| Key lifecycle events: component mount/unmount, navigation, background sync. Keep them meaningful, not noisy. |
187
+
|**debug**|`logger.debug(msg, ctx?)`| Verbose detail useful during development only. Stripped from production builds. |
188
+
|**component**|`logger.component(name, event, ctx?)`| Convenience wrapper for component lifecycle events — equivalent to `info` with a standardised format. |
0 commit comments