Class: Findbug::Capture::MessageHandler
- Inherits:
-
Object
- Object
- Findbug::Capture::MessageHandler
- Defined in:
- lib/findbug/capture/message_handler.rb
Overview
MessageHandler captures non-exception events (messages).
WHY CAPTURE MESSAGES?
Not every important event is an exception. Sometimes you want to track:
-
Security events: “User exceeded rate limit”
-
Business events: “Payment failed validation”
-
Warnings: “External API response slow”
-
Debug info: “Cache miss for critical key”
These aren’t exceptions, but you want to see them in your error dashboard alongside actual errors.
USAGE
Findbug.("User exceeded rate limit", :warning, user_id: 123)
Findbug.("Payment validation failed", :error, order_id: 456)
Findbug.("Scheduled task completed", :info, duration: 45.2)
Class Method Summary collapse
-
.capture(message, level = :info, extra_context = {}) ⇒ Object
Capture a message.
Class Method Details
.capture(message, level = :info, extra_context = {}) ⇒ Object
Capture a message
38 39 40 41 42 43 44 45 |
# File 'lib/findbug/capture/message_handler.rb', line 38 def capture(, level = :info, extra_context = {}) return unless Findbug.enabled? event_data = build_event_data(, level, extra_context) Storage::RedisBuffer.push_error(event_data) rescue StandardError => e Findbug.logger.error("[Findbug] MessageHandler failed: #{e.}") end |