module Krane::DeferredSummaryLogging

Adds the methods krane requires to your logger class. These methods include helpers for logging consistent headings, as well as facilities for displaying key information later, in a summary section, rather than when it occurred.

Attributes

summary[R]

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/krane/deferred_summary_logging.rb, line 10
def initialize(*args)
  reset
  super
end

Public Instance Methods

blank_line(level = :info) click to toggle source
# File lib/krane/deferred_summary_logging.rb, line 20
def blank_line(level = :info)
  public_send(level, "")
end
heading(text, secondary_msg = '', secondary_msg_color = :cyan) click to toggle source
# File lib/krane/deferred_summary_logging.rb, line 29
def heading(text, secondary_msg = '', secondary_msg_color = :cyan)
  padding = (100.0 - (text.length + secondary_msg.length)) / 2
  blank_line
  part1 = ColorizedString.new("#{'-' * padding.floor}#{text}").cyan
  part2 = ColorizedString.new(secondary_msg).colorize(secondary_msg_color)
  part3 = ColorizedString.new('-' * padding.ceil).cyan
  info(part1 + part2 + part3)
end
phase_heading(phase_name) click to toggle source
# File lib/krane/deferred_summary_logging.rb, line 24
def phase_heading(phase_name)
  @current_phase += 1
  heading("Phase #{@current_phase}: #{phase_name}")
end
print_summary(status) click to toggle source

Outputs the deferred summary information saved via @logger.summary.add_action and @logger.summary.add_paragraph

reset() click to toggle source
# File lib/krane/deferred_summary_logging.rb, line 15
def reset
  @summary = DeferredSummary.new
  @current_phase = 0
end