From e04f380f42b2d9b895b2a4abec6a2e0944f85132 Mon Sep 17 00:00:00 2001 From: Glenn Sarti Date: Fri, 31 Mar 2017 16:53:24 -0700 Subject: [PATCH] (maint) Emit console messages when debugging is enabled 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. --- lib/vmpooler/logger.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/vmpooler/logger.rb b/lib/vmpooler/logger.rb index 2c70756..f481246 100644 --- a/lib/vmpooler/logger.rb +++ b/lib/vmpooler/logger.rb @@ -12,6 +12,8 @@ module Vmpooler 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