Skip to content

Commit

Permalink
(maint) Emit console messages when debugging is enabled
Browse files Browse the repository at this point in the history
Previously all log messages may be written to a text file, however during
development or debugging it is also useful if the log messages are written to
the console.  This commit changes the logger class to emit messages to the
console, via `puts`, if the VMPOOLER_DEBUG environment variable is set.
  • Loading branch information
glennsarti committed Apr 1, 2017
1 parent d4a50e5 commit e04f380
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/vmpooler/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def log(_level, string)
time = Time.new
stamp = time.strftime('%Y-%m-%d %H:%M:%S')

puts "[#{stamp}] #{string}" if ENV['VMPOOLER_DEBUG']

open(@file, 'a') do |f|
f.puts "[#{stamp}] #{string}"
end
Expand Down

0 comments on commit e04f380

Please sign in to comment.