Class: Quonfig::SSEConfigClient::ReconnectCountingLogger
- Inherits:
-
Object
- Object
- Quonfig::SSEConfigClient::ReconnectCountingLogger
- Defined in:
- lib/quonfig/sse_config_client.rb
Overview
ld-eventsource auto-reconnects on a clean socket EOF (server FIN) internally — it never calls on_error for that case, only for ECONNREFUSED-style failures (qfg-ie49; see chaos scenario 09). The one signal it emits for any reconnect is an info-level “Will retry connection after …” line, logged once per reconnect attempt and never on the first connect. Wrapping the logger we hand to SSE::Client lets the SDK observe those internal reconnects without touching the data path. This is the only reconnect hook ld-eventsource >= 2.0 exposes.
Constant Summary collapse
- RECONNECT_SIGNAL =
'Will retry connection after'- LEVELS =
%i[trace debug info warn error fatal].freeze
Instance Method Summary collapse
-
#initialize(wrapped, &on_reconnect) ⇒ ReconnectCountingLogger
constructor
A new instance of ReconnectCountingLogger.
- #level ⇒ Object
- #level=(new_level) ⇒ Object
Constructor Details
#initialize(wrapped, &on_reconnect) ⇒ ReconnectCountingLogger
Returns a new instance of ReconnectCountingLogger.
22 23 24 25 |
# File 'lib/quonfig/sse_config_client.rb', line 22 def initialize(wrapped, &on_reconnect) @wrapped = wrapped @on_reconnect = on_reconnect end |
Instance Method Details
#level ⇒ Object
61 62 63 |
# File 'lib/quonfig/sse_config_client.rb', line 61 def level @wrapped&.level end |
#level=(new_level) ⇒ Object
65 66 67 |
# File 'lib/quonfig/sse_config_client.rb', line 65 def level=(new_level) @wrapped.level = new_level if @wrapped.respond_to?(:level=) end |