Module: Logi::Logger
- Included in:
- Compiler
- Defined in:
- lib/logi/logger.rb
Class Method Summary collapse
- .black(text) ⇒ Object
- .blue(text) ⇒ Object
- .color(rgb, text) ⇒ Object
- .cyan(text) ⇒ Object
- .green(text) ⇒ Object
- .log(msg) ⇒ Object
- .magenta(text) ⇒ Object
- .red(text) ⇒ Object
- .strip_cwd_path(path) ⇒ Object
- .strip_home_path(path) ⇒ Object
- .strip_path(path) ⇒ Object
- .white(text) ⇒ Object
- .yellow(text) ⇒ Object
Class Method Details
.black(text) ⇒ Object
10 |
# File 'lib/logi/logger.rb', line 10 def black text; color(30, text); end |
.blue(text) ⇒ Object
14 |
# File 'lib/logi/logger.rb', line 14 def blue text; color(34, text); end |
.color(rgb, text) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/logi/logger.rb', line 18 def color rgb, text if nocolor = [:nocolor] text elsif nocolor.nil? && !$stdout.tty? # auto-detect text else "\e[#{rgb}m#{text}\e[0m" end end |
.cyan(text) ⇒ Object
16 |
# File 'lib/logi/logger.rb', line 16 def cyan text; color(36, text); end |
.green(text) ⇒ Object
12 |
# File 'lib/logi/logger.rb', line 12 def green text; color(32, text); end |
.log(msg) ⇒ Object
5 6 7 8 |
# File 'lib/logi/logger.rb', line 5 def log msg return if [:quiet] puts msg end |
.magenta(text) ⇒ Object
15 |
# File 'lib/logi/logger.rb', line 15 def magenta text; color(35, text); end |
.red(text) ⇒ Object
11 |
# File 'lib/logi/logger.rb', line 11 def red text; color(31, text); end |
.strip_cwd_path(path) ⇒ Object
36 37 38 |
# File 'lib/logi/logger.rb', line 36 def strip_cwd_path path path.sub(Dir.pwd, '.') end |
.strip_home_path(path) ⇒ Object
32 33 34 |
# File 'lib/logi/logger.rb', line 32 def strip_home_path path path.sub(ENV['HOME'], '~') end |
.strip_path(path) ⇒ Object
28 29 30 |
# File 'lib/logi/logger.rb', line 28 def strip_path path strip_home_path(strip_cwd_path(path)) end |
.white(text) ⇒ Object
17 |
# File 'lib/logi/logger.rb', line 17 def white text; color(37, text); end |
.yellow(text) ⇒ Object
13 |
# File 'lib/logi/logger.rb', line 13 def yellow text; color(33, text); end |