Sha256: 7ac7cc0a8a1d2ae2a04f0abfe08dbf083192678c8520cbc2ae686d786281353f

Contents?: true

Size: 567 Bytes

Versions: 2

Compression:

Stored size: 567 Bytes

Contents

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
semantic_logger-4.5.0 lib/semantic_logger/formatters/json.rb
semantic_logger-4.4.0 lib/semantic_logger/formatters/json.rb