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



119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/webhookdb/service/middleware.rb', line 119

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