Sha256: c47d62b1164f8bd3b07267b841d46fbc6b0d73b30b2b427939f48f630e3c90c7

Contents?: true

Size: 1.14 KB

Versions: 35

Compression:

Stored size: 1.14 KB

Contents

class Converter
  class Logger
    include Term::ANSIColor

    def log_status(status)
      puts bold status
    end

    def log_file_info(s)
      puts "    #{magenta s}"
    end

    def log_transform(*args, from: caller[1][/`.*'/][1..-2].sub(/^block in /, ''))
      puts "    #{cyan from}#{cyan ": #{args * ', '}" unless args.empty?}"
    end

    def log_processing(name)
      puts yellow "  #{File.basename(name)}"
    end

    def log_processed(name)
      puts green "    #{name}"
    end

    def log_http_get_file(url, cached = false)
      s = "  #{'CACHED ' if cached}GET #{url}..."
      if cached
        puts dark green s
      else
        puts dark cyan s
      end
    end

    def log_http_get_files(files, from, cached = false)
      return if files.empty?
      s = "  #{'CACHED ' if cached}GET #{files.length} files from #{from} #{files * ' '}..."
      if cached
        puts dark green s
      else
        puts dark cyan s
      end
    end

    def puts(*args)
      STDERR.puts *args unless @silence
    end

    alias log puts

    def silence_log
      @silence = true
      yield
    ensure
      @silence = false
    end
  end
end

Version data entries

35 entries across 35 versions & 8 rubygems

Version Path
entreprise7pro-bootstrap-sass-3.4.7 tasks/converter/logger.rb
entreprise7pro-bootstrap-sass-3.4.6 tasks/converter/logger.rb
chroma-js-1.0.7 tasks/converter/logger.rb
chroma-js-1.0.5 tasks/converter/logger.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/logger.rb
bootstrap-sass-3.2.0.4 tasks/converter/logger.rb
bootstrap-sass-3.4.1 tasks/converter/logger.rb
bootstrap-sass-3.4.0 tasks/converter/logger.rb
toolbox_esten-1.0.0 tasks/converter/logger.rb
bootstrap-sass-3.3.7 tasks/converter/logger.rb
style-sass-1.0.0 tasks/converter/logger.rb