Sha256: 5ee4d0c09bc7c3efa3992d9caa110c90f0cb08691e4d69333798f10968dbd72e

Contents?: true

Size: 738 Bytes

Versions: 14

Compression:

Stored size: 738 Bytes

Contents

require 'logger'

module Terraspace
  class Logger < ::Logger
    def initialize(*args)
      super
      self.formatter = Formatter.new
      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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
terraspace-0.6.13 lib/terraspace/logger.rb
terraspace-0.6.12 lib/terraspace/logger.rb
terraspace-0.6.11 lib/terraspace/logger.rb
terraspace-0.6.10 lib/terraspace/logger.rb
terraspace-0.6.9 lib/terraspace/logger.rb
terraspace-0.6.8 lib/terraspace/logger.rb
terraspace-0.6.7 lib/terraspace/logger.rb
terraspace-0.6.6 lib/terraspace/logger.rb
terraspace-0.6.5 lib/terraspace/logger.rb
terraspace-0.6.4 lib/terraspace/logger.rb
terraspace-0.6.3 lib/terraspace/logger.rb
terraspace-0.6.2 lib/terraspace/logger.rb
terraspace-0.6.1 lib/terraspace/logger.rb
terraspace-0.6.0 lib/terraspace/logger.rb