lib/docrb/spec/fixtures/logrb.rb
# Internal: Logs a JSON entry to the current output.
#
# level       - The severity of the message to be logged.
# msg         - The message to be logged
# error       - Either an Exception object or nil. This parameter is used
#               to provide extra information on the logged entry.
# fields      - A Hash containing metadata to be included in the logged
#               entry.
# caller_meta - An Array containing the caller's location and name.
Logs a JSON entry to the current output.
level       - The severity of the message to be logged.
msg         - The message to be logged
error       - Either an Exception object or nil. This parameter is used
to provide extra information on the logged entry.
fields      - A Hash containing metadata to be included in the logged
entry.
caller_meta - An Array containing the caller's location and name.
Logs a JSON entry to the current output . level - The severity of the message to be logged . msg - The message to be logged error - Either an Exception object or nil . This parameter is used to provide extra information on the logged entry . fields - A Hash containing metadata to be included in the logged entry . caller_meta - An Array containing the caller ' s location and name .
def json(level, msg, error, fields, caller_meta)
    fields ||= {}
    fields.merge! @fields
    data = {
      level: level,
      caller: caller_meta.first,
      msg: msg,
      ts: Time.now.utc.to_i
    }
    data[:stacktrace] = backtrace(error) if level == :error
    data.merge!(fields)
    write_output("#{data.to_json}\n")
  end
def json ( level , msg , error , fields , caller_meta ) fields ||= { } fields . merge! @fields data = { level : level , caller : caller_meta . first , msg : msg , ts : Time . now . utc . to_i } data [ :stacktrace ] = backtrace ( error ) if level == :error data . merge! ( fields ) write_output ( "#{data.to_json}\n" ) end
Internal: Logs a JSON entry to the current output.
Internal : Logs a JSON entry to the current output .
level
msg
error
fields
caller_meta