Class: RailsFlowMap::Logging::StructuredFormatter
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- RailsFlowMap::Logging::StructuredFormatter
- Defined in:
- lib/rails_flow_map/logging.rb
Overview
Custom formatter for structured log output
Instance Method Summary collapse
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/rails_flow_map/logging.rb', line 31 def call(severity, time, progname, msg) context = Thread.current[:rails_flow_map_context] || {} context_str = context.empty? ? '' : " [#{context.map { |k, v| "#{k}=#{v}" }.join(', ')}]" "[#{time.strftime('%Y-%m-%d %H:%M:%S')}] #{severity}#{context_str}: #{msg}\n" end |