class Logtail::Contexts::HTTP

@private

Attributes

host[R]
method[R]
path[R]
remote_addr[R]
request_id[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/logtail/contexts/http.rb, line 9
def initialize(attributes)
  @host = attributes[:host]
  @method = attributes[:method]
  @path = attributes[:path]
  @remote_addr = attributes[:remote_addr]
  @request_id = attributes[:request_id]
end

Public Instance Methods

to_hash() click to toggle source

Builds a hash representation containing simple objects, suitable for serialization (JSON).

# File lib/logtail/contexts/http.rb, line 18
def to_hash
  @to_hash ||= {
    http: Util::NonNilHashBuilder.build do |h|
      h.add(:host, host)
      h.add(:method, method)
      h.add(:path, path)
      h.add(:remote_addr, remote_addr)
      h.add(:request_id, request_id)
    end
  }
end