Sha256: d6b168bcb8354a9006d696d343e0b5cc3102f7bd034783cda5c9869bd47c20b3

Contents?: true

Size: 426 Bytes

Versions: 1

Compression:

Stored size: 426 Bytes

Contents

module Fluent
  module RecordSerializer
    def serialize_record(format, record)
      if format == 'json'
        json_dump(record)
      elsif format == 'yaml'
        record.to_yaml
      end
    end

    private

    begin
      require 'oj'
      def json_dump(record)
        Oj.dump(record, :mode => :compat)
      end
    rescue LoadError
      def json_dump(record)
        record.to_json
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-record-serializer-0.1.0 lib/fluent/plugin/record_serializer.rb