Skip to content

Commit

Permalink
Overwrite comparable methods in Proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jrothrock committed Aug 29, 2024
1 parent b94a4a6 commit 4b27260
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/scout_apm/logging/loggers/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ module ScoutApm
module Logging
module Loggers
# Holds both the original application logger and the new one. Relays commands to both.
class Proxy < BasicObject
include ::Kernel

class Proxy
def self.create_with_loggers(*loggers)
new.tap do |proxy_logger|
loggers.each { |logger| proxy_logger.add_scout_loggers(logger) }
Expand Down Expand Up @@ -38,8 +36,20 @@ def level=(level)
@loggers.first.level = level
end

def is_a?(klass)
@loggers.first.is_a?(klass)
end

def kind_of?(klass)
@loggers.first.is_a?(klass)
end

def instance_of?(klass)
@loggers.first.instance_of?(klass)
end

def class
::Logger
@loggers.first.class
end

def is_scout_proxy_logger?
Expand Down

0 comments on commit 4b27260

Please sign in to comment.