Class: Navy::Logger
- Inherits:
-
Object
- Object
- Navy::Logger
- Defined in:
- lib/navy/logger.rb
Constant Summary collapse
- COLOURS =
{ :black => 30, :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35, :cyan => 36, :bright_black => 30, :bright_red => 31, :bright_green => 32, :bright_yellow => 33, :bright_blue => 34, :bright_magenta => 35, :bright_cyan => 36 }
Instance Attribute Summary collapse
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
- #color(color, message) ⇒ Object
- #debug(message) ⇒ Object
- #error(message) ⇒ Object
- #info(message) ⇒ Object
- #notice(message) ⇒ Object
- #threaded! ⇒ Object
Instance Attribute Details
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
19 20 21 |
# File 'lib/navy/logger.rb', line 19 def prefix @prefix end |
Instance Method Details
#color(color, message) ⇒ Object
21 22 23 |
# File 'lib/navy/logger.rb', line 21 def color(color, ) "\033[0;#{COLOURS[color]}m#{}\033[0;00m" end |
#debug(message) ⇒ Object
37 38 39 |
# File 'lib/navy/logger.rb', line 37 def debug() log end |
#error(message) ⇒ Object
33 34 35 |
# File 'lib/navy/logger.rb', line 33 def error() log color(:red, ) end |
#info(message) ⇒ Object
29 30 31 |
# File 'lib/navy/logger.rb', line 29 def info() log color(:yellow, ) end |
#notice(message) ⇒ Object
25 26 27 |
# File 'lib/navy/logger.rb', line 25 def notice() log color(:cyan,) end |