module Ark::Log

Logging/messaging facilities intended for STDOUT

Constants

Conf

Configuration details for Ark::Log. Settings:

:quiet

Suppress all messages of any verbosity

:verbose

Allow high-verbosity messages to be printed

:timed

Include the time since Timer#reset was called in all messages

Public Instance Methods

dbg(str, indent=0) click to toggle source

Write high-verbosity debugging information to STDOUT

# File lib/ark/utility.rb, line 77
def dbg(str, indent=0)
  say(str, '...', true, indent)
end
msg(str, indent=0) click to toggle source

Write a low-verbosity message to STDOUT

# File lib/ark/utility.rb, line 73
def msg(str, indent=0)
  say(str, '>>>', false, indent)
end
pulse(str, time, &block) click to toggle source

Pulse a message for the duration of the execution of a block

# File lib/ark/utility.rb, line 86
def pulse(str, time, &block)
  # TODO
end
say(msg, sym='...', loud=false, indent=0) click to toggle source

Write msg to standard output according to verbosity settings. Not meant to be used directly

# File lib/ark/utility.rb, line 56
def say(msg, sym='...', loud=false, indent=0)
  return false if Conf[:quiet]
  return false if loud && !Conf[:verbose]
  unless msg == ''
    time = ""
    if Conf[:timed]
      time = Timer.time.to_s.ljust(4, '0')
      time = time + " "
    end
    indent = "    " * indent
    indent = " " if indent == ""
    puts "#{time}#{sym}#{indent}#{msg}"
  else
    puts
  end
end
wrn(str, indent=0) click to toggle source

Write a high-verbosity warning to STDOUT

# File lib/ark/utility.rb, line 81
def wrn(str, indent=0)
  say(str, '???', true, indent)
end