class LogStash::Codecs::Pretty
The pretty codec will output your Logstash event data using the Ruby Awesome Print library.
Constants
- AWESOME_OPTIONS
AWESOME_OPTIONS
= {:color => {:logstash_timestamp => :green}} disabled options, awesome_print coloring option is buggy and only occurs once and it cannot be tested.
Public Instance Methods
decode(data)
click to toggle source
# File lib/logstash/codecs/pretty.rb, line 29 def decode(data) raise "Not implemented" end
encode(event)
click to toggle source
# File lib/logstash/codecs/pretty.rb, line 34 def encode(event) @encoder.call(event) end
encode_default(event)
click to toggle source
# File lib/logstash/codecs/pretty.rb, line 38 def encode_default(event) @on_event.call(event, event.to_hash.awesome_inspect + NL) end
encode_with_metadata(event)
click to toggle source
# File lib/logstash/codecs/pretty.rb, line 42 def encode_with_metadata(event) @on_event.call(event, event.to_hash_with_metadata.awesome_inspect + NL) end
register()
click to toggle source
# File lib/logstash/codecs/pretty.rb, line 17 def register require "awesome_print" AwesomePrint.defaults = AWESOME_OPTIONS if @metadata @encoder = method(:encode_with_metadata) else @encoder = method(:encode_default) end end