lib/logspot.rb in logspot-0.3.0 vs lib/logspot.rb in logspot-0.4.0
- old
+ new
@@ -1,18 +1,18 @@
require_relative 'initialize'
class LoGspot
LOG_LEVELS = %w(DEBUG INFO WARN ERROR FATAL)
- def initialize(file_name, wrapper = nil)
+ def initialize(file_or_file_name = STDOUT, wrapper = nil)
wrapper = ->(output, data) {
base = "[#{Time.now.strftime('%Y/%m/%d %H:%M:%S')} #{level}] "
if data[:space]
base = ' ' * base.length
end
output.puts(message: "#{base}#{data[:message]}")
}
- @file = Output::File.new(file_name)
+ @file = Output::File.new(file_or_file_name)
@output = @original_output = Output::Wrap.new(wrapper, @file)
@level = nil
end
def tagged(tag, &block)