class Logtail::Logger::JSONFormatter

Structures your log messages into JSON.

logger = Logtail::Logger.new(STDOUT)
logger.formatter = Logtail::JSONFormatter.new

Example message:

{"level":"info","dt":"2016-09-01T07:00:00.000000-05:00","message":"My log message"}

Public Instance Methods

call(severity, time, progname, msg) click to toggle source
# File lib/logtail/logger.rb, line 110
def call(severity, time, progname, msg)
  # use << for concatenation for performance reasons
  build_log_entry(severity, time, progname, msg).to_json << "\n"
end