lib/semantic_logger/appender/base.rb in semantic_logger-2.18.0 vs lib/semantic_logger/appender/base.rb in semantic_logger-2.19.0

- old
+ new

@@ -57,12 +57,12 @@ # Log message entry << " -- #{log.message}" if log.message # Payload - unless log.payload.nil? || (log.payload.respond_to?(:empty?) && log.payload.empty?) - entry << ' -- ' << log.payload.inspect + if payload = log.payload_to_s(false) + entry << ' -- ' << payload end # Exceptions log.each_exception do |exception, i| entry << (i == 0 ? ' -- Exception: ' : "\nCause: ") @@ -81,11 +81,11 @@ Proc.new do |log| colors = SemanticLogger::Appender::AnsiColors level_color = colors::LEVEL_MAP[log.level] # Header with date, time, log level and process info - entry = "#{log.formatted_time} #{level_color}#{log.level_to_s}#{colors::CLEAR} [#{log.process_info}]" + entry = "#{log.formatted_time} #{level_color}#{log.level_to_s}#{colors::CLEAR} [#{log.process_info}]" # Tags entry << ' ' << log.tags.collect { |tag| "[#{level_color}#{tag}#{colors::CLEAR}]" }.join(' ') if log.tags && (log.tags.size > 0) # Duration @@ -96,13 +96,11 @@ # Log message entry << " -- #{log.message}" if log.message # Payload - unless log.payload.nil? || (log.payload.respond_to?(:empty?) && log.payload.empty?) - payload = log.payload - payload = (defined?(AwesomePrint) && payload.respond_to?(:ai)) ? payload.ai(multiline: false) : payload.inspect + if payload = log.payload_to_s(true) entry << ' -- ' << payload end # Exceptions log.each_exception do |exception, i| @@ -121,11 +119,10 @@ # default log level def level @level || :trace end - ############################################################################ - protected + private # Initializer for Abstract Class SemanticLogger::Appender # # Parameters # level [Symbol]