Module: Snapcrawl::LogHelpers
Constant Summary collapse
- SEVERITY_COLORS =
{ 'INFO' => :b, 'WARN' => :y, 'ERROR' => :r, 'FATAL' => :r, 'DEBUG' => :c, }
Instance Method Summary collapse
Instance Method Details
#log_formatter ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/snapcrawl/log_helpers.rb', line 15 def log_formatter proc do |severity, _time, _prog, | severity_color = SEVERITY_COLORS[severity] line = "#{severity_color}`#{severity.rjust 5}` : #{}\n" use_colors? ? colorize(line) : strip_colors(line) end end |
#tty? ⇒ Boolean
27 28 29 30 31 32 33 34 |
# File 'lib/snapcrawl/log_helpers.rb', line 27 def tty? case ENV['TTY'] when 'on' then true when 'off' then false else $stdout.tty? end end |