Skip to content

DEV: Improve logging and fix some formatting errors #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions plugin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# name: discourse-oauth2-basic
# about: Allows users to login to your forum using a basic OAuth2 provider.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax tree error

# about: Allows users to login to your forum using a basic OAuth2 provider.
# meta_topic_id: 33879
# version: 0.3
# authors: Robin Ward
Expand Down Expand Up @@ -50,7 +50,7 @@ def recurse(obj, keys)
class OAuth2FaradayFormatter < Faraday::Logging::Formatter
def request(env)
warn <<~LOG
OAuth2 Debugging: request #{env.method.upcase} #{env.url.to_s}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rubocop error

OAuth2 Debugging: request #{env.method.upcase} #{env.url}

Headers:
#{env.request_headers.to_yaml}
Expand All @@ -64,7 +64,7 @@ def response(env)
warn <<~LOG
OAuth2 Debugging: response status #{env.status}

From #{env.method.upcase} #{env.url.to_s}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rubocop error

From #{env.method.upcase} #{env.url}

Headers:
#{env.request_headers.to_yaml}
Expand Down Expand Up @@ -236,8 +236,12 @@ def fetch_user_details(token, id)
log <<-LOG
user_json request: #{user_json_method} #{user_json_url}

response:
#{user_json_response.to_yaml}
request headers: #{headers}

response status: #{user_json_response.status}

response body:
#{user_json_response.body}
Comment on lines +239 to +244
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things added to the logs

LOG

if user_json_response.status == 200
Expand Down