Class: ThemeBandit::Log

Inherits:
Logger
  • Object
show all
Defined in:
lib/theme_bandit/util/log.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/theme_bandit/util/log.rb', line 5

def message
  @message
end

Class Method Details

.colorize(text, color_code) ⇒ Object



7
8
9
# File 'lib/theme_bandit/util/log.rb', line 7

def colorize(text, color_code)
  $stdout.write "\e[#{color_code}m#{text}\e[0m\n"
end

.green(text) ⇒ Object



27
28
29
30
# File 'lib/theme_bandit/util/log.rb', line 27

def green(text)
  @message = text
  colorize(text, 32)
end

.patch(old_file_name, new_file_name) ⇒ Object



17
18
19
20
# File 'lib/theme_bandit/util/log.rb', line 17

def patch(old_file_name, new_file_name)
  @message = "#{old_file_name} failed to download. Manually patch .theme/public/*/#{new_file_name} in its place"
  logger.error @message
end

.red(text) ⇒ Object



11
12
13
14
15
# File 'lib/theme_bandit/util/log.rb', line 11

def red(text)
  @message = text
  colorize(text, 31)
  logger.error text
end

.yellow(text) ⇒ Object



22
23
24
25
# File 'lib/theme_bandit/util/log.rb', line 22

def yellow(text)
  @message = text
  colorize(text, 33)
end