Class: AIRefactor::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/ai_refactor/logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(verbose: false, debug: false) ⇒ Logger

Returns a new instance of Logger.



5
6
7
8
# File 'lib/ai_refactor/logger.rb', line 5

def initialize(verbose: false, debug: false)
  @verbose = verbose
  @debug = debug
end

Instance Method Details

#debug(message) ⇒ Object



14
15
16
17
# File 'lib/ai_refactor/logger.rb', line 14

def debug(message)
  return unless @debug
  puts message.colorize(:light_black)
end

#error(message, bold: false) ⇒ Object



32
33
34
# File 'lib/ai_refactor/logger.rb', line 32

def error(message, bold: false)
  puts message.colorize(color: :red, mode: bold ? :bold : :default)
end

#info(message) ⇒ Object



10
11
12
# File 'lib/ai_refactor/logger.rb', line 10

def info(message)
  puts message
end

#success(message) ⇒ Object



28
29
30
# File 'lib/ai_refactor/logger.rb', line 28

def success(message)
  puts message.colorize(color: :green, mode: :bold)
end

#verbose(message) ⇒ Object



19
20
21
22
# File 'lib/ai_refactor/logger.rb', line 19

def verbose(message)
  return unless @verbose
  puts "[#{message}]".colorize(:light_blue)
end

#warn(message) ⇒ Object



24
25
26
# File 'lib/ai_refactor/logger.rb', line 24

def warn(message)
  puts message.colorize(:yellow)
end