Class: Awestruct::AwestructLoggerMultiIO
- Inherits:
-
Object
- Object
- Awestruct::AwestructLoggerMultiIO
- Defined in:
- lib/awestruct/logger.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(log_to_debug_io = false, *targets) ⇒ AwestructLoggerMultiIO
constructor
A new instance of AwestructLoggerMultiIO.
- #write(*args) ⇒ Object
Constructor Details
#initialize(log_to_debug_io = false, *targets) ⇒ AwestructLoggerMultiIO
Returns a new instance of AwestructLoggerMultiIO.
5 6 7 8 |
# File 'lib/awestruct/logger.rb', line 5 def initialize(log_to_debug_io = false, *targets) @targets = targets @log_to_debug = log_to_debug_io end |
Instance Method Details
#close ⇒ Object
21 22 23 |
# File 'lib/awestruct/logger.rb', line 21 def close @targs.each(&:close) end |
#write(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/awestruct/logger.rb', line 10 def write(*args) @targets.each do |target| if target.instance_of?(File) && @log_to_debug target.write(*args) end if args[0] !~/\[/ && target.instance_of?(IO) target.write(*args) end end end |