Class: LogStash::Codecs::RubyDebug
- Inherits:
-
Base
- Object
- Base
- LogStash::Codecs::RubyDebug
- Defined in:
- lib/logstash/codecs/rubydebug.rb
Overview
The rubydebug codec will output your Logstash event data using the Ruby Amazing Print library.
Constant Summary collapse
- AMAZING_OPTIONS =
AMAZING_OPTIONS = => {:logstash_timestamp => :green}
{}
Instance Method Summary collapse
- #decode(data) ⇒ Object
- #encode(event) ⇒ Object
- #encode_default(event) ⇒ Object
-
#encode_with_metadata(event) ⇒ Object
def encode_default.
- #register ⇒ Object
Instance Method Details
#decode(data) ⇒ Object
28 29 30 |
# File 'lib/logstash/codecs/rubydebug.rb', line 28 def decode(data) raise "Not implemented" end |
#encode(event) ⇒ Object
33 34 35 |
# File 'lib/logstash/codecs/rubydebug.rb', line 33 def encode(event) @encoder.call(event) end |
#encode_default(event) ⇒ Object
37 38 39 |
# File 'lib/logstash/codecs/rubydebug.rb', line 37 def encode_default(event) @on_event.call(event, event.to_hash.ai + NL) end |
#encode_with_metadata(event) ⇒ Object
def encode_default
41 42 43 |
# File 'lib/logstash/codecs/rubydebug.rb', line 41 def (event) @on_event.call(event, event..ai + NL) end |
#register ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/logstash/codecs/rubydebug.rb', line 16 def register require "amazing_print" AmazingPrint.defaults = AMAZING_OPTIONS if @metadata @encoder = method(:encode_with_metadata) else @encoder = method(:encode_default) end end |