Module: Simple::CLI::Logger::ColoredLogger
- Extended by:
- ColoredLogger
- Included in:
- ColoredLogger
- Defined in:
- lib/simple/cli/logger/colored_logger.rb
Overview
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
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 =
rubocop:disable Style/ClassVars
Time.now
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
Instance Method Summary collapse
- #debug(*args, &block) ⇒ Object
- #error(*args, &block) ⇒ Object
- #info(*args, &block) ⇒ Object
- #success(*args, &block) ⇒ Object
- #warn(*args, &block) ⇒ Object
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level.
7 8 9 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 7 def level @level end |
Instance Method Details
#debug(*args, &block) ⇒ Object
41 42 43 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 41 def debug(*args, &block) log :debug, *args, &block end |
#error(*args, &block) ⇒ Object
53 54 55 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 53 def error(*args, &block) log :error, *args, &block end |
#info(*args, &block) ⇒ Object
45 46 47 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 45 def info(*args, &block) log :info, *args, &block end |
#success(*args, &block) ⇒ Object
57 58 59 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 57 def success(*args, &block) log :success, *args, &block end |
#warn(*args, &block) ⇒ Object
49 50 51 |
# File 'lib/simple/cli/logger/colored_logger.rb', line 49 def warn(*args, &block) log :warn, *args, &block end |