Module: Usps::Imis::LoggerHelpers
- Included in:
- Logger
- Defined in:
- lib/usps/imis/logger_helpers.rb
Overview
Formatted logger helpers
Instance Method Summary collapse
Instance Method Details
#json(data) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/usps/imis/logger_helpers.rb', line 12 def json(data) hash = data.is_a?(String) ? JSON.parse(data) : data tagged('JSON') { multiline(JSON.pretty_generate(hash)) } rescue StandardError multiline(data) end |
#multiline(string, level: :debug) ⇒ Object
8 9 10 |
# File 'lib/usps/imis/logger_helpers.rb', line 8 def multiline(string, level: :debug) string.split("\n").each { public_send(level, it) } end |