Module: Logrithm::Formatters::Pretty
- Defined in:
- lib/logrithm/formatters/pretty.rb
Class Method Summary collapse
Class Method Details
.formatter ⇒ Object
| 4 5 6 7 8 9 10 11 12 | # File 'lib/logrithm/formatters/pretty.rb', line 4 def formatter proc do |severity, datetime, _, | '' << Log::INSTANCE.send(:lead, severity, datetime) << parse().map do |formatted| Log::INSTANCE.send(:color, severity).last.colorize(formatted) end.join(Logrithm::Log::JOINER) << $/ end end | 
.parse(message) ⇒ Object
| 15 16 17 18 19 20 21 22 23 | # File 'lib/logrithm/formatters/pretty.rb', line 15 def parse() return enum_for(:parse, ) unless block_given? [*].each do |obj| klazz = obj.class.ancestors.inject(nil) do |memo, k| memo || Utils::Helpers.constantize(k, Logrithm::Spitters) end || Utils::Helpers.constantize(:string, Logrithm::Spitters) yield klazz.new(obj).formatted end end |