Module: Log::Format
- Defined in:
- lib/log/format.rb,
lib/log/format/color.rb
Defined Under Namespace
Class Method Summary collapse
- .header(time, subject, level, device) ⇒ Object
- .line(message, time, subject, level, device, &message_formatter) ⇒ Object
- .message(message, device, &message_formatter) ⇒ Object
Class Method Details
.header(time, subject, level, device) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/log/format.rb', line 21 def self.header(time, subject, level, device) header = "[#{time}] #{subject}" unless level.nil? header << " #{level.to_s.upcase}" end header << ':' Color.header(header, device) end |
.line(message, time, subject, level, device, &message_formatter) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/log/format.rb', line 3 def self.line(, time, subject, level, device, &) header = nil if Defaults.header == :on header = "#{header(time, subject, level, device)} " end "#{header}#{(, device, &)}" end |
.message(message, device, &message_formatter) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/log/format.rb', line 12 def self.(, device, &) return unless block_given? if Log::Defaults.formatters == :on return .(, device) else return end end |