lib/tee_logger.rb in tee_logger-2.1.0 vs lib/tee_logger.rb in tee_logger-2.1.1
- old
+ new
@@ -8,16 +8,17 @@
# shortcut for TeeLogger::TeeLogger.new
def self.new(logdev = DEFAULT_FILE, shift_age = 0, shift_size = 1_048_576)
TeeLogger.new(logdev, shift_age, shift_size)
end
+ # main
class TeeLogger
attr_reader :logger, :console
def initialize(logdev = DEFAULT_FILE, shift_age = 0, shift_size = 1_048_576)
@logger = Logger.new(logdev, shift_age, shift_size)
- @console = Logger.new(STDOUT)
+ @console = Logger.new($stdout)
end
# logging methods.
LOGGING_METHODS.each do |name|
define_method(name) do |progname = nil, &block|
@@ -34,16 +35,16 @@
@console.send(name)
end
end
# TODO: Implement!
- def disable(target)
+ def disable(_target)
# undef_method, remove_method ....
end
# TODO: Implement!
- def enable(target)
+ def enable(_target)
# undef_method, remove_method ....
end
def progname
# TODO: which?
@@ -52,9 +53,19 @@
end
def progname=(name = nil)
@logger.progname = name
@console.progname = name
+ end
+
+ def formatter
+ @logger.formatter
+ @console.formatter
+ end
+
+ def formatter=(formatter)
+ @logger.formatter = formatter
+ @console.formatter = formatter
end
# def close
# @logger.close
# # @console.close