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
# File 'lib/webhookdb/service/middleware.rb', line 128

def request_tags(env)
  tags = super
  begin
    tags[:customer_id] = env["warden"].user(:customer)&.id || 0
  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).
    nil
  end
  return tags
end