11 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 772a8b8453 style(logging): remove section divider comments in console_log_handler_test 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 885c8e56aa test(logging): add handlerKey, fault-isolation, and critical-level coverage
- handlerKey: verify two instances of same class with distinct keys coexist,
  same key replaces existing handler, both handlers receive dispatched records
- fault-isolation: verify handles()/handle() throwing does not crash dispatch
  and remaining handlers still receive the record
- critical level: verify Level.critical maps to SentryLevel.fatal in both
  captureException and captureMessage paths of SentryEventHandler
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 c36384fb73 test(logging): strengthen handler pipeline tests
- app_logger_registry: add _OtherFakeHandler subclass; fix
  'dispatches to multiple handlers' to register two distinct types
  and assert both receive the record; use const LogRecord
- sentry_breadcrumb_handler: track capturedExceptions/capturedMessages
  in fake; assert both are empty in 'does not call' test
- sentry_event_handler: add SentryLevel to fake captured records;
  assert mapped severity in captureException/captureMessage tests
2026-04-28 11:31:12 +07:00
dab246 57975331d5 test(logger): add unit tests for logging pipeline (ADR-0078) 2026-04-28 11:31:12 +07:00