lib/terraspace/logger.rb in terraspace-0.5.12 vs lib/terraspace/logger.rb in terraspace-0.6.0
- old
+ new
@@ -3,18 +3,25 @@
module Terraspace
class Logger < ::Logger
def initialize(*args)
super
self.formatter = Formatter.new
- self.level = :info
+ self.level = ENV['TS_LOG_LEVEL'] || :info # note: only respected when config.logger not set in config/app.rb
end
def format_message(severity, datetime, progname, msg)
line = if @logdev.dev == $stdout || @logdev.dev == $stderr
msg # super simple format if stdout
else
super # use the configured formatter
end
line =~ /\n$/ ? line : "#{line}\n"
+ end
+
+ # Used to allow terraform output to always go to stdout
+ # Terraspace output goes to stderr by default
+ # See: terraspace/shell.rb
+ def stdout(msg)
+ puts msg
end
end
end