class Insights::Loggers::StdErrorLogger::Formatter

Attributes

logger_app_name[RW]

Public Instance Methods

app_name() click to toggle source
# File lib/insights/loggers/std_error_logger.rb, line 36
def app_name
  logger_app_name || ENV['LOGGER_APP_NAME'] || "insights_application"
end
call(severity, time, progname, msg) click to toggle source
# File lib/insights/loggers/std_error_logger.rb, line 19
def call(severity, time, progname, msg)
  payload = {
    :@timestamp    => format_datetime(time),
    :hostname      => hostname,
    :pid           => $PROCESS_ID,
    :tid           => thread_id,
    :service       => progname,
    :level         => translate_error(severity),
    :message       => prefix_task_id(msg2str(msg)),
    :request_id    => request_id,
    :tags          => [app_name],
    :labels        => {"app" => app_name}
  }.compact

  JSON.generate(payload) << "\n"
end