lib/aws_cft_tools/runbook.rb in aws-cft-tools-0.1.0 vs lib/aws_cft_tools/runbook.rb in aws-cft-tools-0.1.1
- old
+ new
@@ -46,10 +46,11 @@
# @return AwsCftTools::Runbook
#
def initialize(configuration = {})
@options = configuration
@client = AwsCftTools::Client.new(options)
+ @stdout = $stdout
end
# @!group Callbacks
##
@@ -133,9 +134,20 @@
if options[:noop]
puts "#{description} (noop)"
else
puts description
end
+ end
+
+ ##
+ # @param note [String] a debug note
+ #
+ # Prints the given content to stdout if running in +debug+ mode. Debug statements are output
+ # without any capture when running multiple threads.
+ #
+ def debug(note = nil)
+ return unless note && options[:debug]
+ @stdout.puts "DEBUG\nDEBUG " + note.split(/\n/).join("\nDEBUG ") + "\nDEBUG"
end
##
# @param description [String] an optional verbose description
# @yield runs the block if in +verbose+ mode