Skip to content

Commit

Permalink
Rails.logger is ActiveSupport::BroadcastLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
yawboakye committed Aug 21, 2024
1 parent ed4e496 commit 3cff133
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/vigiles/archive/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class InextricableResponseBodyError < StandardError
attr_reader :response_body_class

sig { params(response_body_class: String).void }
def initialize(response_body_class:)
def initialize(response_body_class)
@response_body_class = response_body_class
super("failed to extract response body: response_body_class=#{response_body_class}")
end
Expand Down Expand Up @@ -44,7 +44,7 @@ def initialize(stack_depth, max_stack_depth)
case (inner_body = body.instance_variable_get(:@body))
when Rack::BodyProxy then extract_body_from_rack_body_proxy(inner_body, stack_depth + 1)
when Array then inner_body[0] || "null"
else raise InextricableResponseBodyError.new(inner_body.class.name)
else raise InextricableResponseBodyError, inner_body.class.name
end
end

Expand Down Expand Up @@ -73,7 +73,7 @@ def self.from(res)
rack_response: res,
content_type: res.headers["Content-Type"] || "unknown_content_type",
headers: res.headers.as_json,
payload: extract_payload(res) || {__false_body: :body_may_be_nil},
payload: extract_payload(res) || { __false_body: :body_may_be_nil },
status: res.status
)
end
Expand Down
3 changes: 2 additions & 1 deletion lib/vigiles/middleware/record_conversation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def call(env)
logger.warn \
"[vigiles] conversation recorder error: " \
"error_message=#{e.message} " \
"error_class=#{e.class}"
"error_class=#{e.class} " \
"backtrace=#{e.backtrace}"
ensure
# no matter what happens we shouldn't prevent the rack
# response from being returned. at this point, the only
Expand Down
2 changes: 1 addition & 1 deletion lib/vigiles/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module Vigiles
class Options < T::Struct
const :capture_exception, T.proc.params(a0: StandardError).void
const :logger, ::Logger
const :logger, T.any(::Logger, ActiveSupport::BroadcastLogger)

sig { returns(Options) }
def self.make_default_options
Expand Down

0 comments on commit 3cff133

Please sign in to comment.