class Fluent::Plugin::StdoutPPOutput
Constants
- TTY_COLOR
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_stdout_pp.rb, line 23 def configure(conf) super @time_color = @time_color.intern if TTY_COLOR[@time_color].nil? raise ConfigError, "stdout_pp: unknown color name #{@time_color} in time_color" end @tag_color = @tag_color.intern if TTY_COLOR[@tag_color].nil? raise ConfigError, "stdout_pp: unknown color name #{@tag_color} in tag_color" end end
multi_workers_ready?()
click to toggle source
# File lib/fluent/plugin/out_stdout_pp.rb, line 52 def multi_workers_ready? true end
process(tag, es)
click to toggle source
# File lib/fluent/plugin/out_stdout_pp.rb, line 37 def process(tag, es) tag_colored = TTY_COLOR[@tag_color] + tag + TTY_COLOR[:normal] es.each do |time, record| time_colored = TTY_COLOR[@time_color] + Time.at(time).localtime.to_s + TTY_COLOR[:normal] if @pp json = JSON.pretty_generate(record) else json = Yajl.dump(record) end json = CodeRay.scan(json, :json).terminal if @record_colored log.write "#{time_colored} #{tag_colored}: #{json}\n" end log.flush end