#
# To run this example, just do
#
#   ruby log-trace-example.rb
#
# You should see a file "debug.log" in your current directory.
#

begin
  require 'rubygems'
rescue LoadError
end
require 'dev-utils/debug'
require 'extensions/enumerable'  # dev-utils depends on extensions anyway.

debug "Running sanity check of dev-utils/debug logging and tracing."

x, y = 5, 10
trace 'x + y'
trace 'Process.pid'

debug "Now we test the various output formatters."

words = %w(wren fibonnaci smelt bovine smeglicious craptacular
           inoccidental myrmidon boondoggle)
word_lengths = words.build_hash { |word| [word, word.length] }

[:p, :s, :pp, :y].each_with_index do |symbol, idx|
  debug ''
  debug "#{idx+1}. #{symbol.inspect} format"
  trace 'words', symbol
  debug ''
  trace 'word_lengths', symbol
end