mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-27 02:18:41 -05:00
(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:
parent
d962886cf8
commit
626195685f
1 changed files with 3 additions and 1 deletions
|
|
@ -11,9 +11,11 @@ module Vmpooler
|
||||||
def log(_level, string)
|
def log(_level, string)
|
||||||
time = Time.new
|
time = Time.new
|
||||||
stamp = time.strftime('%Y-%m-%d %H:%M:%S')
|
stamp = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
open(@file, 'a') do |f|
|
open(@file, 'a') do |f|
|
||||||
f.puts "[#{stamp}] #{string}"
|
f.puts "[#{stamp}] #{string}"
|
||||||
|
if ENV['VMPOOLER_DEBUG']
|
||||||
|
puts "[#{stamp}] #{string}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue