Class: Pushapp::Logger
- Inherits:
-
Logger
- Object
- Logger
- Pushapp::Logger
- Defined in:
- lib/pushapp/logger.rb
Instance Attribute Summary collapse
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
Instance Method Summary collapse
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pushapp/logger.rb', line 8 def initialize super($stdout) @shell = Thor::Shell::Color.new self.progname = '[pushapp]' # DEBUG INFO WARN ERROR FATAL UNKNOWN @colors = { 'DEBUG' => :blue, 'INFO' => :green, 'WARN' => :magenta, 'ERROR' => :red, 'FATAL' => :red, 'UNKOWN' => :black } self.formatter = proc { |severity, datetime, progname, msg| color = @colors[severity] progname = @shell.set_color progname, color, :bold sev = @shell.set_color "#{severity}:", color msg = @shell.set_color msg, color "#{progname} #{sev} #{msg}\n" } end |
Instance Attribute Details
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
6 7 8 |
# File 'lib/pushapp/logger.rb', line 6 def shell @shell end |