Sha256: cae0fceab4c1d388bef2524c3eb71cd4fd1fa730b33afcfa8508888d04d00940

Contents?: true

Size: 478 Bytes

Versions: 2

Compression:

Stored size: 478 Bytes

Contents

# frozen_string_literal: true

require "json"
require "dry/logger/formatters/structured"

module Dry
  module Logger
    module Formatters
      # JSON formatter.
      #
      # This formatter returns log entries in JSON format.
      #
      # @since 0.1.0
      # @api public
      class JSON < Structured
        # @since 0.1.0
        # @api private
        def format(entry)
          "#{::JSON.generate(entry.as_json)}#{NEW_LINE}"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-logger-1.0.0.rc2 lib/dry/logger/formatters/json.rb
dry-logger-1.0.0.rc1 lib/dry/logger/formatters/json.rb