DEV: Include a basic oauth faraday formatter in core for usage in managed authenticators (#28758)

We currently have some occurrences of ____FaradayFormatter for OAuth logs. This commit creates a generic formatter so that any new authenticators can use it.
This commit is contained in:
Natalie Tay 2024-09-05 22:29:29 +08:00 committed by GitHub
parent d5670069f5
commit 6bb8ac54cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
# frozen_string_literal: true
class Auth::OauthFaradayFormatter < Faraday::Logging::Formatter
def request(env)
warn <<~LOG
OAuth Debugging: request #{env.method.upcase} #{env.url}
Headers:
#{env.request_headers}
Body:
#{env[:body]}
LOG
end
def response(env)
warn <<~LOG
OAuth Debugging: response status #{env.status}
From #{env.method.upcase} #{env.url}
Headers:
#{env.response_headers}
Body:
#{env[:body]}
LOG
end
end