Sha256: 64b7d5573fc547dfe728fbbfeb8c27118c2b9e6e2132288a73071d41fd30fe37

Contents?: true

Size: 525 Bytes

Versions: 18

Compression:

Stored size: 525 Bytes

Contents

require "json"
module Sapience
  module Formatters
    class Json < Raw
      # Default JSON time format is ISO8601
      def initialize(options = {})
        options               = options.dup
        options[:time_format] = :iso_8601 unless options.key?(:time_format)
        super(options)
      end

      # Returns log messages in JSON format
      def call(log, logger)
        h = super(log, logger)
        h.delete(:time)
        h[:timestamp] = format_time(log.time)
        h.to_json
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
sapience-0.2.4 lib/sapience/formatters/json.rb
sapience-0.2.3 lib/sapience/formatters/json.rb
sapience-0.2.2 lib/sapience/formatters/json.rb
sapience-0.2.1 lib/sapience/formatters/json.rb
sapience-0.2.0 lib/sapience/formatters/json.rb
sapience-0.1.13 lib/sapience/formatters/json.rb
sapience-0.1.12 lib/sapience/formatters/json.rb
sapience-0.1.11 lib/sapience/formatters/json.rb
sapience-0.1.10 lib/sapience/formatters/json.rb
sapience-0.1.9 lib/sapience/formatters/json.rb
sapience-0.1.8 lib/sapience/formatters/json.rb
sapience-0.1.7 lib/sapience/formatters/json.rb
sapience-0.1.6 lib/sapience/formatters/json.rb
sapience-0.1.5 lib/sapience/formatters/json.rb
sapience-0.1.4 lib/sapience/formatters/json.rb
sapience-0.1.3 lib/sapience/formatters/json.rb
sapience-0.1.2 lib/sapience/formatters/json.rb
sapience-0.1.1 lib/sapience/formatters/json.rb