Class: Abqari::Server::QuietLog

Inherits:
WEBrick::Log
  • Object
show all
Defined in:
lib/abqari/server.rb

Overview

WEBrick logs every exception that escapes a request thread as an ERROR with a full backtrace — including the ones that only mean "the browser went away". A dev session produces a steady stream of those: each open tab holds an SSE connection to /__reload__, and navigating or reloading tears that socket down without a clean close, so the sock.eof? check in WEBrick's own request loop raises Errno::ECONNRESET from io_fillbuf.

The SSE handler's rescue can't help here: WEBrick raises before it ever dispatches to application code, so the error never reaches our block. The logger is the only interception point.

Suppression is by exception CLASS, never by message text — a genuine fault whose message happens to mention a reset connection is still logged in full. Set ABQARI_VERBOSE_LOG=true to opt out and see everything WEBrick reports, which is what you want when debugging the socket layer itself.

Constant Summary collapse

CLIENT_DISCONNECTS =

Each of these means the peer hung up. None is actionable, and none indicates a fault in the site being served.

[
  Errno::ECONNRESET,   # peer sent RST — by far the common one
  Errno::EPIPE,        # wrote to a socket the peer already closed
  Errno::ECONNABORTED, # aborted between accept and read
  Errno::ENOTCONN      # socket no longer connected
].freeze

Instance Method Summary collapse

Instance Method Details

#error(msg) ⇒ Object



62
63
64
65
66
# File 'lib/abqari/server.rb', line 62

def error(msg)
  return if CLIENT_DISCONNECTS.any? { |klass| msg.is_a?(klass) }

  super
end