Skip to content

Commit

Permalink
Request Instrumentation with ActiveSupport (#60)
Browse files Browse the repository at this point in the history
Set default log level to debug
  • Loading branch information
tonchev-ivan authored May 5, 2020
1 parent 9c944a9 commit 091a29d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/api_valve/forwarder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def run_request(request)
end

def log_request(request)
ApiValve.logger.info do
ApiValve.logger.debug do
format(
'-> %<method>s %<endpoint>s%<path>s',
method: request.method.upcase,
Expand All @@ -80,7 +80,7 @@ def log_request(request)
end

def log_response(response, elapsed_time)
ApiValve.logger.info do
ApiValve.logger.debug do
format(
'<- %<status>s in %<ms>dms',
status: response.status,
Expand All @@ -94,6 +94,7 @@ def faraday
url: endpoint,
ssl: {verify: false}
) do |config|
config.request :instrumentation
config.adapter Faraday.default_adapter
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/api_valve/middleware/permission_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def call(env)
@app.call(env)
else
message = handler(env).message
ApiValve.logger.info { message }
ApiValve.logger.debug { message }
render_error ApiValve::Error::Forbidden.new message
end
end
Expand Down

0 comments on commit 091a29d

Please sign in to comment.