Sha256: c3f8b9060a3e751c0f6767d68f0958acf9ccfd7f73b56a444158a69273803388

Contents?: true

Size: 867 Bytes

Versions: 8

Compression:

Stored size: 867 Bytes

Contents

module Wordmove
  class Logger < ::Logger
    MAX_LINE = 70

    def task(title)
      prefix = "▬" * 2
      title = " #{title} "
      padding = "▬" * padding_length(title)

      puts "\n" + prefix + title.light_white + padding
    end

    def task_step(local_step, title)
      if local_step
        puts "    local".cyan + " | ".black + title.to_s
      else
        puts "   remote".yellow + " | ".black + title.to_s
      end
    end

    def error(message)
      puts "    ✗ error".red + " | ".black + message.to_s
    end

    def success(message)
      puts "    ✓ success".green + " | ".black + message.to_s
    end

    def debug(message)
      puts "    ⚠ debug".magenta + " | ".black + message.to_s
    end

    private

    def padding_length(line)
      result = MAX_LINE - line.length
      result.positive? ? result : 0
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wordmove-2.5.1 lib/wordmove/logger.rb
wordmove-2.5.0 lib/wordmove/logger.rb
wordmove-2.4.4 lib/wordmove/logger.rb
wordmove-2.4.3 lib/wordmove/logger.rb
wordmove-2.4.2 lib/wordmove/logger.rb
wordmove-2.4.1 lib/wordmove/logger.rb
wordmove-2.4.0 lib/wordmove/logger.rb
wordmove-2.3.1 lib/wordmove/logger.rb