test/appender/file_test.rb in semantic_logger-4.0.0 vs test/appender/file_test.rb in semantic_logger-4.1.0
- old
+ new
@@ -8,11 +8,11 @@
describe SemanticLogger::Appender::File do
before do
SemanticLogger.default_level = :trace
@time = Time.new
@io = StringIO.new
- @appender = SemanticLogger::Appender::File.new(@io)
+ @appender = SemanticLogger::Appender::File.new(io: @io)
@hash = {session_id: 'HSSKLEU@JDK767', tracking_number: 12345}
@hash_str = @hash.inspect.sub("{", "\\{").sub("}", "\\}")
@thread_name = Thread.current.name
@file_name_reg_exp = RUBY_VERSION.to_f <= 2.0 ? ' (mock|file_test).rb:\d+' : ' file_test.rb:\d+'
end
@@ -84,10 +84,10 @@
end
end
describe 'custom formatter' do
before do
- @appender = SemanticLogger::Appender::File.new(@io) do |log|
+ @appender = SemanticLogger::Appender::File.new(io: @io) do |log|
tags = log.tags.collect { |tag| "[#{tag}]" }.join(' ') + ' ' if log.tags && (log.tags.size > 0)
message = log.message.to_s
message << ' -- ' << log.payload.inspect if log.payload
message << ' -- ' << "#{log.exception.class}: #{log.exception.message}\n#{(log.exception.backtrace || []).join("\n")}" if log.exception