Class: Alephant::Logger::Base
- Inherits:
-
Object
- Object
- Alephant::Logger::Base
show all
- Defined in:
- lib/alephant/logger/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(drivers) ⇒ Base
Returns a new instance of Base.
6
7
8
9
10
11
12
|
# File 'lib/alephant/logger/base.rb', line 6
def initialize(drivers)
@drivers = drivers
unless drivers.any? { |driver| driver.is_a? Alephant::Logger::JSON }
drivers << Alephant::Logger::JSON.new("app.log")
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
18
19
20
21
22
|
# File 'lib/alephant/logger/base.rb', line 18
def method_missing(name, *args)
drivers.each do |driver|
driver.send(name, *args) if driver.respond_to? name
end
end
|
Instance Method Details
#respond_to?(name) ⇒ Boolean
24
25
26
27
28
|
# File 'lib/alephant/logger/base.rb', line 24
def respond_to?(name)
drivers.any? do |driver|
driver.respond_to?(name) || super
end
end
|
#write(*args) ⇒ Object
14
15
16
|
# File 'lib/alephant/logger/base.rb', line 14
def write(*args)
self.<< *args
end
|