lib/fusuma/multi_logger.rb in fusuma-2.1.0 vs lib/fusuma/multi_logger.rb in fusuma-2.2.0

- old
+ new

@@ -9,24 +9,23 @@ include Singleton attr_reader :err_logger attr_accessor :debug_mode - @@filepath = nil - def self.filepath=(filepath) - @@filepath = filepath + class << self + attr_writer :filepath end def initialize - if @@filepath - logfile = File.new(@@filepath, 'a') + filepath = self.class.instance_variable_get('@filepath') + if filepath + logfile = File.new(filepath, 'a') super(logfile) $stderr = logfile - @err_logger = Logger.new($stderr) else super($stdout) - @err_logger = Logger.new($stderr) end + @err_logger = Logger.new($stderr) @debug_mode = false end def debug(msg) return unless debug_mode?