Class: Mushin::Logger
- Inherits:
-
Logger
- Object
- Logger
- Mushin::Logger
- Defined in:
- lib/mushin/logger.rb
Defined Under Namespace
Modules: Colors
Instance Method Summary collapse
Instance Method Details
#format_message(level, *args) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/mushin/logger.rb', line 51 def (level, *args) if self.class::Colors::SCHEMA[@logdev.dev] && @logdev.dev.tty? begin index = self.class.const_get(level.sub('ANY','UNKNOWN')) color_name = self.class::Colors::SCHEMA[@logdev.dev][index] color = self.class::Colors.const_get(color_name.to_s.upcase) rescue NameError color = '0;0' end "\e[#{color}m#{(level, *args)}\e[0;0m" else (level, *args) end end |
#format_message_colorless ⇒ Object
49 |
# File 'lib/mushin/logger.rb', line 49 alias |
#rainbow(*args) ⇒ Object
66 67 68 69 70 |
# File 'lib/mushin/logger.rb', line 66 def rainbow(*args) SEV_LABEL.each_with_index do |level, i| add(i, *args) end end |