(maint) Output logging to STDOUT when debugging

Previously log messages would only go to the log file.  This commit adds
additional functionality to the logger by output to STDOUT if the environment
variable VMPOOLER_DEBUG is set.
This commit is contained in:
Glenn Sarti 2017-01-26 15:09:00 -08:00
parent d962886cf8
commit 626195685f

View file

@ -11,9 +11,11 @@ module Vmpooler
def log(_level, string)
time = Time.new
stamp = time.strftime('%Y-%m-%d %H:%M:%S')
open(@file, 'a') do |f|
f.puts "[#{stamp}] #{string}"
if ENV['VMPOOLER_DEBUG']
puts "[#{stamp}] #{string}"
end
end
end
end