Class: Steno::JsonPrettifier
Defined Under Namespace
Classes: ParseError
Constant Summary collapse
- FIELD_ORDER =
%w[ timestamp source process_id thread_id fiber_id location data log_level message ]
- MIN_COL_WIDTH =
14
Instance Method Summary collapse
-
#initialize(excluded_fields = []) ⇒ JsonPrettifier
constructor
A new instance of JsonPrettifier.
- #prettify_line(line) ⇒ Object
Constructor Details
#initialize(excluded_fields = []) ⇒ JsonPrettifier
Returns a new instance of JsonPrettifier.
26 27 28 29 30 |
# File 'lib/steno/json_prettifier.rb', line 26 def initialize(excluded_fields = []) @time_format = "%Y-%m-%d %H:%M:%S.%6N" @excluded_fields = Set.new(excluded_fields) @max_src_len = MIN_COL_WIDTH end |
Instance Method Details
#prettify_line(line) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/steno/json_prettifier.rb', line 32 def prettify_line(line) begin json_record = Yajl::Parser.parse(line) rescue Yajl::ParseError => e raise ParseError, e.to_s end format_record(json_record) end |