Skip to content

feat: log flag updates from the listener; pass exceptions in PSR-3 context - #5

Merged
roncohen merged 1 commit into
mainfrom
feat/listener-logging
Dec 3, 2026
Merged

roncohen merged 1 commit into
mainfrom
feat/listener-logging

Conversation

@roncohen

@roncohen roncohen commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Compared the listener's logging with the .NET SDK (FlagUpdatesSse.cs) and closed two gaps.

  • Flag updates are logged. On a flags-updated event the listener now logs Reflag flags updated to version {version} at debug. .NET logs refreshed flag definitions at info on every refresh; PHP also refreshes on request paths across many workers, so only the listener logs, at debug.
  • Exceptions in the PSR-3 exception context key for connect failures and stream failures, so Monolog, Sentry and Flare keep the stack trace (the .NET SDK passes the exception object). The message text is unchanged.

Other log sites still log only the exception class on purpose: store, fallback and cloud errors can carry hostnames or SAS URLs.

Verified live against front.reflag.com: GET /sse/server with Bearer auth, reflag-sdk-version, Accept: text/event-stream and Cache-Control: no-cache returned 200 text/event-stream. The listener connected, refreshed to version 24 and stayed connected for 40 s.

Tests: full suite passes (1447 tests), PHPStan clean; ListenerTest asserts the new debug line and the exception key.

…ntext

The listener now logs 'Reflag flags updated to version {version}' at debug when a flags-updated event triggers a refresh (the .NET SDK logs every refresh at info; PHP refreshes on request paths too, so only the listener logs). Connect and stream failures also pass the Throwable as 'exception' so Monolog, Sentry and Flare keep the stack trace. Other log sites still log only the exception class: store, fallback and cloud errors can carry hosts or SAS URLs.
@roncohen
roncohen enabled auto-merge December 3, 2026 10:47

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: low

no actionable findings

@roncohen
roncohen added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit c8e1723 Dec 3, 2026
29 checks passed
@roncohen
roncohen deleted the feat/listener-logging branch December 3, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant