Sha256: a9db550309fa0788b7817e933bbdc63b26f481b1b6e6afe0e953d641a32e93ee

Contents?: true

Size: 638 Bytes

Versions: 9

Compression:

Stored size: 638 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

9 entries across 9 versions & 1 rubygems

Version Path
celluloid-essentials-0.20.5 lib/celluloid/logging/incident.rb
celluloid-essentials-0.20.2.1 lib/celluloid/logging/incident.rb
celluloid-essentials-0.20.2 lib/celluloid/logging/incident.rb
celluloid-essentials-0.20.1.1 lib/celluloid/logging/incident.rb
celluloid-essentials-0.20.1 lib/celluloid/logging/incident.rb
celluloid-essentials-0.20.0 lib/celluloid/logging/incident.rb
celluloid-essentials-0.20.0.pre17 lib/celluloid/logging/incident.rb
celluloid-essentials-0.20.0.pre16 lib/celluloid/logging/incident.rb
celluloid-essentials-0.20.0.pre15 lib/celluloid/logging/incident.rb