class Pakyow::Logger::Formatters::Logfmt
Formats log messages as logfmt.
@example
severity=INFO timestamp="2016-06-20 10:08:29 -0500" id=678cf582 type=http elapsed=0.01ms method=GET uri=/ ip=127.0.0.1 severity=INFO timestamp="2016-06-20 10:08:29 -0500" id=678cf582 type=http elapsed=1.56ms message="hello 2016-06-20 10:08:29 -0500" severity=INFO timestamp="2016-06-20 10:08:29 -0500" id=678cf582 type=http elapsed=3.37ms status=200
@api private
Constants
- UNESCAPED_STRING
Private Instance Methods
serialize(message)
click to toggle source
# File lib/pakyow/logger/formatters/logfmt.rb, line 21 def serialize(message) first = true message.each_pair do |key, value| value = case value when Array value.join(",") else value.to_s end unless value.match?(UNESCAPED_STRING) value = value.dump end unless first @output.call(" ") end @output.call(key) @output.call("=") @output.call(value) first = false end @output.call("\n") end