File: log_event.rb

package info (click to toggle)
ruby-celluloid 0.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 848 kB
  • sloc: ruby: 7,579; makefile: 10
file content (20 lines) | stat: -rw-r--r-- 591 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Celluloid
  # Wraps a single log event.
  class LogEvent
    attr_accessor :id, :severity, :message, :progname, :time

    def initialize(severity, message, progname, time = Time.now, &_block)
      # This id should be ordered. For now relies on Celluloid::UUID to be ordered.
      # May want to use a generation/counter strategy for independence of uuid.
      @id = Internals::UUID.generate
      @severity = severity
      @message = block_given? ? yield : message
      @progname = progname
      @time = time
    end

    def <=>(other)
      @id <=> other.id
    end
  end
end