Sha256: dd94b347daf84b7255c0d7b769dd4d430f6c3c294855ee1c3df6e565f1a30088

Contents?: true

Size: 476 Bytes

Versions: 2

Compression:

Stored size: 476 Bytes

Contents

# frozen_string_literal: true

module OnStrum
  module Logs
    module Formatter
      class Json < Base
        require 'json'

        def self.call(**log_data)
          time_key = OnStrum::Logs.configuration.field_name_time
          json_log = arrange_attrs(
            **log_data,
            time_key => log_data[time_key].strftime(OnStrum::Logs::Formatter::Base::DATETIME_FORMAT)
          ).to_json

          "#{json_log}\n"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
on_strum-logs-1.0.0 lib/on_strum/logs/formatter/json.rb
on_strum-logs-0.3.0 lib/on_strum/logs/formatter/json.rb