Class: TrackRelay::Subscribers::Logger

Inherits:
Base
  • Object
show all
Defined in:
lib/track_relay/subscribers/logger.rb

Overview

Two-output subscriber that surfaces every event in development / production logs and persists untyped (non-catalog) events to a JSONL sidecar for the linter (Plan 08) and the end-to-end test (Plan 09) to consume.

Outputs:

  1. Always writes a human-readable line to ‘Rails.logger.info`: `[track_relay] event=<name> kind=<typed|untyped> params=`

  2. **Only when** Configuration#untyped_log_path is set AND the payload is untyped (‘payload.definition.nil?`), appends a JSONL line to that path. The line shape is locked at:

    “‘json

    "event":      "<event_name>",
    "params":     ["param_a", "param_b"],
    "controller": "ArticlesController",
    "action":     "show",
    "timestamp":  "2026-05-06T12:00:00Z"
    

    “‘

    **Privacy contract (locked in 01-CONTEXT.md):** param VALUES are NEVER written. Only sorted, stringified param NAMES. The JSONL is a “what events fired” audit trail, not a payload log.

The same line shape is read by ‘TrackRelay::Linter` (Plan 08) and asserted by the end-to-end test (Plan 09). Keep these three sites in sync if the shape ever needs to change.

Instance Method Summary collapse

Methods inherited from Base

coerce_event_set, #except_events, filter, #handle, #only_events, #safe_deliver, #set_filter_overrides!, synchronous!

Instance Method Details

#deliver(payload) ⇒ Object



42
43
44
45
# File 'lib/track_relay/subscribers/logger.rb', line 42

def deliver(payload)
  log_human(payload)
  log_untyped_jsonl(payload) if untyped?(payload) && jsonl_path
end