Class: Propel::Logger
- Inherits:
-
Object
- Object
- Propel::Logger
- Defined in:
- lib/propel/logger.rb
Constant Summary collapse
- COLORS =
{ :red => 31, :green => 32, :yellow => 33, }
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Logger
constructor
A new instance of Logger.
- #print(message, color_sym = nil) ⇒ Object
- #puts(message, color_sym = nil) ⇒ Object
- #report_operation(message) ⇒ Object
- #report_status(message, color_sym) ⇒ Object
- #warn(message, color_sym = nil) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Logger
Returns a new instance of Logger.
9 10 11 |
# File 'lib/propel/logger.rb', line 9 def initialize(configuration) @configuration = configuration end |
Instance Method Details
#print(message, color_sym = nil) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/propel/logger.rb', line 13 def print(, color_sym = nil) unless @configuration[:quiet] Kernel.print color(, color_sym) STDOUT.flush end end |
#puts(message, color_sym = nil) ⇒ Object
20 21 22 |
# File 'lib/propel/logger.rb', line 20 def puts(, color_sym = nil) Kernel.puts color(, color_sym) end |
#report_operation(message) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/propel/logger.rb', line 28 def report_operation() if @configuration[:verbose] Kernel.puts("#{}...") else Kernel.print("%-60s" % "#{}:") STDOUT.flush end end |
#report_status(message, color_sym) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/propel/logger.rb', line 37 def report_status(, color_sym) if @configuration[:verbose] Kernel.puts(color(.capitalize, color_sym)) else Kernel.puts("[ #{color(.upcase, color_sym)} ]") end end |
#warn(message, color_sym = nil) ⇒ Object
24 25 26 |
# File 'lib/propel/logger.rb', line 24 def warn(, color_sym = nil) Kernel.warn color(, color_sym) end |