Sha256: 22088b5fed488a1a0f40a117b05c960cfa1818e57699301cdaf40c0562b317b2

Contents?: true

Size: 937 Bytes

Versions: 7

Compression:

Stored size: 937 Bytes

Contents

# Deprecated, do not use in new code, to be removed.
class Gelf
  def deprecate(instead)
    Kernel.caller.first =~ /:in `(.+)'$/
    warn "Gelf##{$1} is deprecated. Use #{instead} instead."
  end

  attr_reader :notifier, :message

  def initialize(hostname, port)
    deprecate('GELF::Notifier.new(hostname, port)')
    @notifier = GELF::Notifier.new(hostname, port)
    @message = {}
  end

  # bizarre, but Gelf did this...
  def send
    deprecate('GELF::Notifier#notify(message)')
    @notifier.notify(@message)
  end

  [:short_message, :full_message, :level, :host, :line, :file].each do |attribute|
    define_method attribute do
      deprecate("GELF::Message##{attribute}")
      @message[attribute]
    end

    define_method "#{attribute}=" do |value|
      deprecate("GELF::Message##{attribute} = value")
      @message[attribute] = value
    end
  end

  def add_additional(key, value)
    @message[key] = value
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gelf-1.1.3 lib/gelf/deprecations.rb
gelf-1.1.1 lib/gelf/deprecations.rb
gelf-1.1.0 lib/gelf/deprecations.rb
gelf-1.1.0.rc1 lib/gelf/deprecations.rb
gelf-1.1.0.gamma1 lib/gelf/deprecations.rb
gelf-1.1.0.beta6 lib/gelf/deprecations.rb
gelf-1.1.0.beta4 lib/gelf/deprecations.rb