class Fluent::TextParser::MaybeJSONParser

Public Instance Methods

parse(text) { |time, record| ... } click to toggle source
Calls superclass method
# File lib/fluent/plugin/parser_maybe_json.rb, line 106
def parse(text)
  super do |time, record|
    
    if record.nil?
      # Parsing failed, return text as log
      record = @hash_value_field_nonjson ? {@hash_value_field_nonjson => text} : text
    end

    if block_given?
      yield time, record
    else
      return time, record
    end
  end
end