Sha256: 0593b62c42b987e5fa2ad3f924feb5db2bb94efb1f636bf9a8af8434186998d2

Contents?: true

Size: 735 Bytes

Versions: 7

Compression:

Stored size: 735 Bytes

Contents

require_relative 'log_formatter_base'
require_relative 'severity_level'

module RTALogger
  # text formatter which receive log_record and
  # returns it's data as delimited text string
  class LogFormatterText < LogFormatterBase
    include SeverityLevel

    def format(log_record)
      return '' unless log_record

      result = log_record.occurred_at.strftime('%F %H:%M:%S:%3N')
      result << @delimiter << log_record.app_name
      result << @delimiter << log_record.topic_title
      result << @delimiter << log_record.context_id.to_s
      result << @delimiter << parse_severity_level_to_s(log_record.severity)
      result << @delimiter << log_record.message.join(' ').gsub(delimiter, '$<$')

      result
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
RTALogger-2.1.2 lib/log_formatter_text.rb
RTALogger-2.1.1 lib/log_formatter_text.rb
RTALogger-2.1.0 lib/log_formatter_text.rb
RTALogger-2.0.2 lib/log_formatter_text.rb
RTALogger-2.0.1 lib/log_formatter_text.rb
RTALogger-2.0.0 lib/log_formatter_text.rb
RTALogger-1.1.1 lib/log_formatter_text.rb