Class: Brakeman::Logger::Plain

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

Direct Known Subclasses

Debug

Instance Method Summary collapse

Methods inherited from Base

#cleanup, #color, #color?, #debug, #log, #show_timing?, #single_context, #spin, #update_progress

Constructor Details

#initialize(options) ⇒ Plain

Returns a new instance of Plain.



91
92
93
94
95
# File 'lib/brakeman/logger.rb', line 91

def initialize(options, *)
  super

  load_highline(options[:output_color])
end

Instance Method Details

#alert(message) ⇒ Object



101
102
103
# File 'lib/brakeman/logger.rb', line 101

def alert(message)
  log color(message, :red)
end

#announce(message) ⇒ Object



97
98
99
# File 'lib/brakeman/logger.rb', line 97

def announce(message)
  log color(message, :bold, :green)
end

#context(description) ⇒ Object



105
106
107
108
109
110
111
112
113
# File 'lib/brakeman/logger.rb', line 105

def context(description, &)
  log "#{color(description, :green)}..."

  if show_timing?
    time_step(description, &)
  else
    yield
  end
end

#time_step(description) ⇒ Object



115
116
117
118
119
120
121
# File 'lib/brakeman/logger.rb', line 115

def time_step(description, &)
  start_t = Time.now
  yield
  duration = Time.now - start_t

  log color(("Completed #{description.to_s.downcase} in %0.2fs" % duration), :gray)
end