class Ougai::Formatters::ConnectFormatter
A JSON formatter compatible with node-bunyan
def _call(severity, time, progname, data)
def _call(severity, time, progname, data) data.merge!({message: data.delete(:msg)}) if data[:timestamp].present? time = data[:timestamp] data.delete(:timestamp) end dump({ name: progname || @app_name, pid: $$, level: severity, timestamp: time.utc.strftime('%FT%T.%6NZ'), }.merge(data)) end
def convert_time(data)
def convert_time(data) #data[:timestamp] = format_datetime(data[:time]) end
def initialize(app_name = nil, hostname = nil, opts = {})
(**opts)
-
:with_newline
(String
) -- the value of with_newline attribute -
:jsonize
(String
) -- the value of jsonize attribute -
:serialize_backtrace
(String
) -- the value of serialize_backtrace attribute -
:trace_max_lines
(String
) -- the value of trace_max_lines attribute -
:trace_indent
(String
) -- the value of trace_indent attribute
Parameters:
-
opts
(Hash
) -- the initial values of attributes -
hostname
(String
) -- hostname (hostname if nil) -
app_name
(String
) -- application name (execution program name if nil)
def initialize(app_name = nil, hostname = nil, opts = {}) aname, hname, opts = Base.parse_new_params([app_name, hostname, opts]) super(aname, hname, opts) init_opts_for_json(opts) end