Class: Webhookdb::Service::Middleware::RequestLogger

Inherits:
Appydays::Loggable::RequestLogger
  • Object
show all
Defined in:
lib/webhookdb/service/middleware.rb

Instance Method Summary collapse

Instance Method Details

#request_tags(env) ⇒ Object



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/webhookdb/service/middleware.rb', line 128

def request_tags(env)
  tags = super
  begin
    c = env["warden"].user(:customer)
  rescue Sequel::DatabaseError
    # If we cant hit the database, ignore this for now.
    # We run this code on all code paths, including those that don't need the customer,
    # and we want those to run even if the DB is down (like health checks, for example).
    c = nil
  end
  if c
    tags[:customer_id] = c.id || 0
    tags[:customer] = c.email
  end
  return tags
end