Class: Yescode::LogfmtFormatter
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- Yescode::LogfmtFormatter
- Defined in:
- lib/yescode/logfmt_formatter.rb
Instance Method Summary collapse
Instance Method Details
#call(severity, datetime, progname, msg) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/yescode/logfmt_formatter.rb', line 5 def call(severity, datetime, progname, msg) = datetime.strftime('%Y-%m-%d %H:%M:%S.%L') parts = { level: severity.downcase, in: progname } parts.merge!(msg) output = "[#{}] #{parts.reject { |_, v| v.nil? }.map { |k, v| "#{k}=#{v}" }.join(' ')}\n" if severity.downcase == "debug" blue(output) else output end end |