Sha256: 0d4ca3f6eb9f66d56c0e949b1be1323b1d8e2aef4f02f7e5ac3c90de6b5cedd5

Contents?: true

Size: 411 Bytes

Versions: 3

Compression:

Stored size: 411 Bytes

Contents

require 'json'
module SemanticLogger
  module Formatters
    class Json < Raw
      # Default JSON time format is ISO8601
      def initialize(time_format: :iso_8601, time_key: :timestamp, **args)
        super(time_format: time_format, time_key: time_key, **args)
      end

      # Returns log messages in JSON format
      def call(log, logger)
        super(log, logger).to_json
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
semantic_logger-4.6.1 lib/semantic_logger/formatters/json.rb
semantic_logger-4.6.0 lib/semantic_logger/formatters/json.rb
semantic_logger-4.6.0.beta1 lib/semantic_logger/formatters/json.rb