Sha256: dd17f9b444fea19d67b30988191489207936cbfe88532e32474efd1fc4bdc350

Contents?: true

Size: 630 Bytes

Versions: 8

Compression:

Stored size: 630 Bytes

Contents

module NSWTopo
  module Log
    SUCCESS = $stdout.tty? ? "\r\e[2K\e[32mnswtopo:\e[0m %s" : "nswtopo: %s"
    FAILURE = $stderr.tty? ? "\r\e[2K\e[31mnswtopo:\e[0m %s" : "nswtopo: %s"
    NEUTRAL = $stdout.tty? ? "\r\e[2Knswtopo: %s" : "nswtopo: %s"
    UPDATE  = "\r\e[2K%s"

    def log_success(message)
      puts SUCCESS % message
    end

    def log_neutral(message)
      puts NEUTRAL % message
    end

    def log_update(message)
      print UPDATE % message if $stdout.tty?
    end

    def log_warn(message)
      warn FAILURE % message
    end

    def log_abort(message)
      abort FAILURE % message
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nswtopo-3.1.3 lib/nswtopo/log.rb
nswtopo-3.1.2 lib/nswtopo/log.rb
nswtopo-3.1.1 lib/nswtopo/log.rb
nswtopo-3.1 lib/nswtopo/log.rb
nswtopo-3.0.1 lib/nswtopo/log.rb
nswtopo-3.0 lib/nswtopo/log.rb
nswtopo-2.0.0 lib/nswtopo/log.rb
nswtopo-2.0.0.pre.beta1 lib/nswtopo/log.rb