Skip to content

v0.6.0

Choose a tag to compare

@damith-dasasian damith-dasasian released this 24 Aug 00:32
· 223 commits to main since this release

Added

  • sendFeedback(text, extras?) — capture what error tracking structurally cannot see. A button that does nothing, a wrong total, the wrong data rendered: none of them throw, so none are logged. Feedback captures that class, and the breadcrumb trail already in memory turns "the discount didn't apply" from a complaint into a reproduction. Headless — the app owns the UI. Carries the same labels and breadcrumbs as any log, plus an optional screenshot.
  • NOTICE severity — ranks between INFO and WARNING, matching Cloud Logging's own ordering. Feedback from a person outranks routine status without being a warning about system health, and any existing severity >= WARNING alert ignores it with no configuration. This widens the public LogSeverity union, which is breaking for exhaustive switch statements and Record<LogSeverity, T> in consumer code.

Changed

  • The 5-minute breadcrumb cutoff now applies when reading, not only when writing. It previously lapsed exactly when nothing was happening: a user who went idle for ten minutes and then hit an error shipped a trail of ten-minute-old steps presented as the path that led there.
  • Every log now carries the full breadcrumb trail (up to 50 entries), not the newest 20. The trail already retained 50; the send path asked for 20, so 30 were kept in memory that nothing could read. Error and feedback payloads grow by roughly 3 KB, or ~2% of Cloud Logging's 256 KB entry limit.

Removed

Breaking: initRequestLogger is gone. Use withLogging. It bound the request scope with AsyncLocalStorage.enterWith(), which is never unwound, so a request's labels outlived the request — a later handler that did not call it inherited whichever user last touched the warm instance. Deprecated in 0.5.0 with a warning naming the leak. withLogging binds with run(), which restores the previous context when the handler settles, including on a throw.

Breaking: setActiveActivity and BaseLabels.activity are gone. activity was ambient state with no natural end — nothing cleared it automatically, so a forgotten one contaminated the rest of the session, and because it fed the dedup signature a stale value distorted which errors were suppressed. A wrong signal in a filtering rule is worse than a missing one. screen looks similar but is self-correcting: the next setScreen() overwrites it. Nothing set activity in practice, so removing it from the signature changes no behaviour — the segment was always empty. See #29 for restoring path discrimination from breadcrumbs, which are derived rather than manually maintained and therefore cannot go stale.

Fixed

  • An unrecognised severity crashed writeLog and destroyed the entry — both dispatch paths look the value up in a fixed table (CONSOLE_FN in emulator mode, firebase-functions' own CONSOLE_SEVERITY inside ffWrite), and a miss resolves to undefined; calling it throws, Logger.send()'s catch swallows it, and the entry disappears with no diagnostic. It also slipped past the min-severity floor, since SEVERITY_ORDER[unknown] is undefined and undefined > n is false. writeLog is exported, so a caller could reach it with a value read from config, crossing a type boundary, or from plain JavaScript. Unknown severities are now written as ERROR with a warning naming the bad value — an entry arriving loud beats one vanishing quietly.