Sha256: 34e6f6474e27c228dac89454cdfc7664df536d6b0dfcb2ee4f38be91d6c4c6f5

Contents?: true

Size: 659 Bytes

Versions: 57

Compression:

Stored size: 659 Bytes

Contents

module Timber
  # Base class for `Timber::Events::*`
  # @private
  class Event
    def message
      raise NotImplementedError.new
    end

    def as_json(options = {})
      raise NotImplementedError.new
    end

    # This ensures that Timber events get logged as messages if they are passed to
    # the standard ::Logger.
    #
    # See: https://github.com/ruby/ruby/blob/f6e77b9d3555c1fbaa8aab1cdc0bd6bde95f62c6/lib/logger.rb#L615
    def inspect
      message
    end

    def to_json(options = {})
      as_json.to_json(options)
    end

    def to_msgpack(*args)
      as_json.to_msgpack(*args)
    end

    def to_s
      message
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
timber-2.1.7 lib/timber/event.rb
timber-2.1.6 lib/timber/event.rb
timber-2.1.5 lib/timber/event.rb
timber-2.1.4 lib/timber/event.rb
timber-2.1.3 lib/timber/event.rb
timber-2.1.2 lib/timber/event.rb
timber-2.1.1 lib/timber/event.rb
timber-2.1.0 lib/timber/event.rb
timber-2.1.0.rc6 lib/timber/event.rb
timber-2.1.0.rc5 lib/timber/event.rb
timber-2.1.0.rc4 lib/timber/event.rb
timber-2.1.0.rc3 lib/timber/event.rb
timber-2.1.0.rc2 lib/timber/event.rb
timber-2.1.0.rc1 lib/timber/event.rb
timber-2.0.24 lib/timber/event.rb
timber-2.0.23 lib/timber/event.rb
timber-2.0.22 lib/timber/event.rb
timber-2.0.21 lib/timber/event.rb
timber-2.0.20 lib/timber/event.rb
timber-2.0.19 lib/timber/event.rb