ForgeOpsTracker.LoggerHandler (forge_ops_tracker v0.1.0)

Copy Markdown View Source

Reports any process crash anywhere in the whole BEAM VM, with zero further wiring needed -- attached via :logger.add_handler/3 (see ForgeOpsTracker.install_handlers/0), a standard :logger_handler behaviour implementation, the same technique the sentry-elixir package uses for the same purpose.

This is a meaningfully stronger "automatic capture" story than the uncaught-exception hooks every other client in this repo installs for its own language: those catch one thread/goroutine/ the main thread; Erlang's :logger already receives a structured crash report -- via :error_logger/proc_lib, gen_server, gen_statem, and Task all forwarding into it, the same mechanism Logger's own console backend uses to print "* (RuntimeError) ..." -- for any* process that terminates abnormally anywhere in the whole VM, supervised or not, because that's simply how OTP's own "let it crash" supervision model already works. Attaching a handler is observing that existing stream, not building a new one.

Filters for meta.crash_reason specifically (a {reason, stacktrace} tuple Erlang's own crash reporting attaches to the log event) rather than every :error-level log line -- an ordinary Logger.error("something went wrong") call from application code has no crash_reason and is deliberately left alone; reporting every error-level log message, not just real crashes, would be far noisier than this client should be by default. Verified directly against a real crashed GenServer's actual log event shape before relying on this filter, not assumed from documentation alone.