class Fluent::Plugin::JqFormatter

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/formatter_jq.rb, line 32
def initialize
  super
end

Public Instance Methods

format(tag, time, record) click to toggle source
# File lib/fluent/plugin/formatter_jq.rb, line 36
def format(tag, time, record)
  item = jq_transform record
  if item.instance_of?(String)
    item
  else
    MultiJson.dump item
  end
rescue JqError
  msg = "Format failed with #{@jq}#{log.on_debug { ' on ' + MultiJson.dump(record) }}, error: #{$!.message}"
  log.error msg
  case @on_error
  when :skip
    return ''
  when :ignore
    return MultiJson.dump(record)
  when :raise_error
    raise msg
  end
end