Sha256: 3c5b762e11df8f47bbe97d83a874580a73f2ccb420ca5fec8e205b5eb2ae4625

Contents?: true

Size: 307 Bytes

Versions: 3

Compression:

Stored size: 307 Bytes

Contents

require 'json'
module SemanticLogger
  module Formatters
    class Json
      # Returns log messages in JSON format
      def call(log, logger)
        h = log.to_h
        h.delete(:time)
        h[:timestamp] = log.time.utc.iso8601(defined?(JRuby) ? 3 : 6)
        h.to_json
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
semantic_logger-3.2.1 lib/semantic_logger/formatters/json.rb
semantic_logger-3.2.0 lib/semantic_logger/formatters/json.rb
semantic_logger-3.1.0 lib/semantic_logger/formatters/json.rb