Skip to content

Commit

Permalink
Logger configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
candanedo committed Feb 16, 2024
1 parent 9a09224 commit 5a7426c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/use_paragon/base.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# frozen_string_literal: true

require "jwt"
require "faraday"
require "use_paragon/configuration"
require "jwt"

module UseParagon
# Basic logic for interacting with UseParagon platform
Expand Down Expand Up @@ -40,7 +39,9 @@ def connection
conn.request :authorization, "Bearer", generate_token
conn.request :json

conn.response :logger, Rails.logger, { errors: true, bodies: true } if config.logger_enabled
if config.logger_enabled
conn.response :logger, config.logger, { errors: true, bodies: true }
end

conn.response :json, content_type: "application/json"
conn.response :raise_error
Expand Down
6 changes: 5 additions & 1 deletion lib/use_paragon/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# frozen_string_literal: true

require "logger"

module UseParagon
# Allows configuration using an initializer
class Configuration
attr_accessor :private_key, :project_id, :base_url, :logger_enabled
attr_accessor :private_key, :project_id, :base_url, :logger, :logger_enabled

def initialize
@base_url = "https://zeus.useparagon.com"
@logger = Logger.new(STDOUT)
@logger_enabled = true
end
end
end

0 comments on commit 5a7426c

Please sign in to comment.