Module: Simple::CLI::Logger::ColoredLogger
- Extended by:
- ColoredLogger
- Included in:
- ColoredLogger
- Defined in:
- lib/simple/cli/logger/colored_logger.rb
Constant Summary collapse
- COLORS =
{ clear: "\e[0m", # Embed in a String to clear all previous ANSI sequences. bold: "\e[1m", # The start of an ANSI bold sequence. black: "\e[30m", # Set the terminal's foreground ANSI color to black. red: "\e[31m", # Set the terminal's foreground ANSI color to red. green: "\e[32m", # Set the terminal's foreground ANSI color to green. yellow: "\e[33m", # Set the terminal's foreground ANSI color to yellow. blue: "\e[34m", # Set the terminal's foreground ANSI color to blue. magenta: "\e[35m", # Set the terminal's foreground ANSI color to magenta. cyan: "\e[36m", # Set the terminal's foreground ANSI color to cyan. white: "\e[37m", # Set the terminal's foreground ANSI color to white. on_black: "\e[40m", # Set the terminal's background ANSI color to black. on_red: "\e[41m", # Set the terminal's background ANSI color to red. on_green: "\e[42m", # Set the terminal's background ANSI color to green. on_yellow: "\e[43m", # Set the terminal's background ANSI color to yellow. on_blue: "\e[44m", # Set the terminal's background ANSI color to blue. on_magenta: "\e[45m", # Set the terminal's background ANSI color to magenta. on_cyan: "\e[46m", # Set the terminal's background ANSI color to cyan. on_white: "\e[47m" # Set the terminal's background ANSI color to white. }
- MESSAGE_COLOR =
{ :info => :cyan, :warn => :yellow, :error => :red, :success => :green, }
- @@started_at =
Time.now
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
Instance Method Summary collapse
- #debug(msg, *args) ⇒ Object
- #error(msg, *args) ⇒ Object
- #info(msg, *args) ⇒ Object
- #success(msg, *args) ⇒ Object
- #warn(msg, *args) ⇒ Object
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level.
4 5 6 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 4 def level @level end |
Instance Method Details
#debug(msg, *args) ⇒ Object
37 38 39 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 37 def debug(msg, *args) log :debug, msg, *args end |
#error(msg, *args) ⇒ Object
49 50 51 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 49 def error(msg, *args) log :error, msg, *args end |
#info(msg, *args) ⇒ Object
41 42 43 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 41 def info(msg, *args) log :info, msg, *args end |
#success(msg, *args) ⇒ Object
53 54 55 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 53 def success(msg, *args) log :success, msg, *args end |
#warn(msg, *args) ⇒ Object
45 46 47 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 45 def warn(msg, *args) log :warn, msg, *args end |