Sha256: 42fba0c9bca5b263922701463395805af261bb91d55a1bd6b5fc849347d80213

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

module Celluloid
  # Wraps all events and context for a single incident.
  class Incident
    attr_accessor :pid
    attr_accessor :events, :triggering_event

    def initialize(events, triggering_event = nil)
      @events = events
      @triggering_event = triggering_event
      @pid = $PROCESS_ID
    end

    # Merge two incidents together. This may be useful if two incidents occur at the same time.
    def merge(*other_incidents)
      merged_events = other_incidents.flatten.inject(events) do |events, incident|
        events += incident.events
      end
      Incident.new(merged_events.sort, triggering_event)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
celluloid-0.18.0 lib/celluloid/logging/incident.rb
celluloid-0.18.0.pre2 lib/celluloid/logging/incident.rb