Class: Navvy::Logger
- Inherits:
-
Logger
- Object
- Logger
- Navvy::Logger
- Defined in:
- lib/navvy/logger.rb
Instance Method Summary collapse
-
#colorized_info(message, color) ⇒ Object
Send colored logs to the logger.
-
#initialize(logdev = STDOUT) ⇒ Logger
constructor
Create a new logger.
Constructor Details
#initialize(logdev = STDOUT) ⇒ Logger
Create a new logger. Works like Logger from Ruby’s standard library, but defaults to STDOUT instead of failing. You can pass a filename to log to.
15 16 17 |
# File 'lib/navvy/logger.rb', line 15 def initialize(logdev = STDOUT) super logdev end |
Instance Method Details
#colorized_info(message, color) ⇒ Object
Send colored logs to the logger. Will only colorize output sent to STDOUT and will call the regular info method when writing to file.
message
31 32 33 34 35 36 |
# File 'lib/navvy/logger.rb', line 31 def colorized_info(, color) unless @logdev.filename return info("\e[#{color}m#{}\e[0m") end info() end |