15 Commits
Author SHA1 Message Date
Dat H. Pham b0e349029f fix(logging): minor issue for logging and docs 2026-04-28 11:31:12 +07:00
dab246 1a30b3f681 refactor(logging): rename handles() to canHandle() for clarity 2026-04-28 11:31:12 +07:00
dab246 26ed041e34 refactor(logging): pass LogRecord to handles() and add default implementation via acceptsLevel() 2026-04-28 11:31:12 +07:00
dab246 4c0fa41d5b refactor(logging): move LogRecord construction into LogRecord.build factory 2026-04-28 11:31:12 +07:00
dab246 c712c9b4b0 feat(logging): support multi-instance handlers via handlerKey
Add handlerKey to LogHandler so that two instances of the same concrete
class can coexist in AppLoggerRegistry (e.g. two ConsoleLogHandlers with
different formatters, or two Sentry handlers targeting different DSNs).

Default key is runtimeType.toString(), preserving existing dedup behaviour
for handlers that do not override it.

Also add @visibleForTesting on resetForTesting() and convert LogHandler
from abstract interface class to abstract class so the default handlerKey
implementation is inherited without requiring each implementor to redeclare it.
2026-04-28 11:31:12 +07:00
dab246 e84b621981 fix(logging): guard handles() in dispatch and replace stale handlers on re-register
- Wrap both handles() and handle() in a single try/catch so a throwing
  handles() cannot abort the pipeline or crash callers
- Replace existing handler by runtimeType instead of silently keeping
  the stale instance, so re-registering with a new config takes effect
- Add recursion-safety comment in SentryManager.addBreadcrumb catch
  block to lock in the invariant for future handler additions
2026-04-28 11:31:12 +07:00
dab246 6c5948557c fix(logging): isolate handler failures and fix fake reporter override
- Wrap each handler.handle() in try/catch so a failing handler does not
  abort the remaining handlers or bubble exceptions to callers
- Fix _FakeSentryReporter.addBreadcrumb signature to match SentryReporter
  interface (add level and category named parameters)
2026-04-28 11:31:12 +07:00
dab246 28000d4636 fix(logging): propagate level/category on breadcrumbs, align captureMessage signature
- addBreadcrumb gains level (default SentryLevel.debug) and category
  params in SentryReporter interface and SentryManager implementation;
  SentryBreadcrumbHandler passes level: SentryLevel.debug, category: 'log'
  so breadcrumbs on error events are clearly labelled in Sentry UI
- captureMessage param order aligned to {extras, level} in SentryManager
  to match the SentryReporter interface declaration
- Test: _FakeSentryReporter updated; new test case asserts level/category
2026-04-28 11:31:12 +07:00
dab246 1b4723ef05 fix(logging): restore per-call webConsoleEnabled as first-class flag
webConsoleEnabled was deprecated in favour of a global constructor flag,
but that removed the ability to force specific log calls visible on web
in release/profile mode — a legitimate need for auth and Sentry init
diagnostics.

Carry webConsoleEnabled through the full pipeline:
LogRecord → buildLogRecord → _dispatch → public log functions.
ConsoleLogHandler reads the flag from the record rather than from its
constructor, so per-call opt-in works independently of build mode.

On web:
- handles() always returns true (filter deferred to handle())
- handle() prints only when record.webConsoleEnabled || isDebugMode

Existing call sites (authorization_interceptors, sentry_config) that
pass webConsoleEnabled: true are preserved and functional again.
2026-04-28 11:31:12 +07:00
dab246 29c89c34b2 fix(logging): pass SentryLevel through reporter interface
SentryReporter.captureException and captureMessage now accept a
SentryLevel parameter so handlers can forward the mapped severity.
SentryEventHandler maps Level.critical → fatal, Level.error → error.
SentryManager forwards the level via scope.level.
2026-04-28 11:31:12 +07:00
dab246 9876db67f8 feat(logger): add SentryEventHandler and SentryBreadcrumbHandler (ADR-0078)
refactor(logger): register Sentry handlers at startup for mobile and web (ADR-0078)
2026-04-28 11:31:12 +07:00
dab246 8ff856b490 feat(sentry): add addBreadcrumb method to SentryManager (ADR-0078)
feat(logger): add SentryEventHandler and SentryBreadcrumbHandler (ADR-0078)
2026-04-28 11:31:12 +07:00
dab246 9b6c768e69 refactor(logger): add AppLoggerRegistry dispatcher and ConsoleLogHandler (ADR-0078) 2026-04-28 11:31:12 +07:00
dab246 49a6b33baa refactor(logger): add LogFormatter interface and platform-specific formatters (ADR-0078) 2026-04-28 11:31:12 +07:00
dab246 3b42d3b873 refactor(logger): add LogRecord, LogHandler, Level core abstractions (ADR-0078) 2026-04-28 11:31:12 +07:00