Sha256: 161be1688e2fd4fb06c23fde79809171d82ed82f2348d8c015fcc97a99a2f227

Contents?: true

Size: 412 Bytes

Versions: 13

Compression:

Stored size: 412 Bytes

Contents

module Dexter
  module Logging
    COLOR_CODES = {
      red: 31,
      green: 32,
      yellow: 33,
      cyan: 36
    }

    def output
      $stdout
    end

    def log(message = "")
      output.puts(message) unless $log_level == "error"
    end

    def colorize(message, color)
      if output.tty?
        "\e[#{COLOR_CODES[color]}m#{message}\e[0m"
      else
        message
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pgdexter-0.5.5 lib/dexter/logging.rb
pgdexter-0.5.4 lib/dexter/logging.rb
pgdexter-0.5.3 lib/dexter/logging.rb
pgdexter-0.5.2 lib/dexter/logging.rb
pgdexter-0.5.1 lib/dexter/logging.rb
pgdexter-0.5.0 lib/dexter/logging.rb
pgdexter-0.4.3 lib/dexter/logging.rb
pgdexter-0.4.2 lib/dexter/logging.rb
pgdexter-0.4.1 lib/dexter/logging.rb
pgdexter-0.4.0 lib/dexter/logging.rb
pgdexter-0.3.10 lib/dexter/logging.rb
pgdexter-0.3.9 lib/dexter/logging.rb
pgdexter-0.3.8 lib/dexter/logging.rb