lib/semantic_logger/log.rb in semantic_logger-4.2.1 vs lib/semantic_logger/log.rb in semantic_logger-4.2.2

- old
+ new

@@ -147,11 +147,11 @@ # Add result of block as message or payload if not nil if block_given? && (result = yield) if result.is_a?(String) message = message.nil? ? result : "#{message} -- #{result}" assign(message: message, payload: payload, exception: exception) - elsif message.nil? && result.is_a?(Hash) + elsif message.nil? && result.is_a?(Hash) && [:message, :payload, :exception].any? { |k| result.key? k } assign(result) elsif payload&.respond_to?(:merge) assign(message: message, payload: payload.merge(result), exception: exception) else assign(message: message, payload: result, exception: exception) @@ -238,10 +238,10 @@ # 18934:thread 23 test_logging.rb:51 def process_info(thread_name_length = 30) file, line = file_name_and_line(true) file_name = " #{file}:#{line}" if file - "#{$PROCESS_ID}:#{format("%.#{thread_name_length}s", thread_name)}#{file_name}" + "#{$$}:#{format("%.#{thread_name_length}s", thread_name)}#{file_name}" end CALLER_REGEXP = /^(.*):(\d+).*/ # Extract the filename and line number from the last entry in the supplied backtrace