Class: GrapeLogging::Formatters::Default
- Inherits:
-
Object
- Object
- GrapeLogging::Formatters::Default
- Defined in:
- lib/grape_logging/formatters/default.rb
Instance Method Summary collapse
Instance Method Details
#call(severity, datetime, _, data) ⇒ Object
4 5 6 |
# File 'lib/grape_logging/formatters/default.rb', line 4 def call(severity, datetime, _, data) "[#{datetime}] #{severity} -- #{format(data)}\n" end |
#format(data) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/grape_logging/formatters/default.rb', line 8 def format(data) if data.is_a?(String) data elsif data.is_a?(Exception) format_exception(data) elsif data.is_a?(Hash) "#{data.delete(:status)} -- #{format_hash(data.delete(:time))} -- #{data.delete(:method)} #{data.delete(:path)} #{format_hash(data)}" else data.inspect end end |