Module: Padrino::Logger::Colorize
- Defined in:
- lib/padrino-core/logger.rb
Constant Summary collapse
- ColoredLevels =
Colors for levels
{ :fatal => [:bold, :red], :error => [:default, :red], :warn => [:default, :yellow], :info => [:default, :green], :debug => [:default, :cyan], :devel => [:default, :magenta] }
Instance Method Summary collapse
-
#colorize(string, *colors) ⇒ Object
Colorize our level.
- #stylized_level(level) ⇒ Object
Instance Method Details
#colorize(string, *colors) ⇒ Object
Colorize our level.
256 257 258 |
# File 'lib/padrino-core/logger.rb', line 256 def colorize(string, *colors) string.colorize(:color => colors[0], :mode => colors[1]) end |
#stylized_level(level) ⇒ Object
260 261 262 263 |
# File 'lib/padrino-core/logger.rb', line 260 def stylized_level(level) style = "\e[%d;%dm" % ColoredLevels[level].map{|color| String::Colorizer.modes[color] || String::Colorizer.colors[color] } [style, super, "\e[0m"] * '' end |