Sha256: 7bc369a2f6255c730148335effa57347ecb866be277d4c06ed1096b3fb02d81d

Contents?: true

Size: 1019 Bytes

Versions: 2

Compression:

Stored size: 1019 Bytes

Contents

#!/usr/bin/env bash

if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi

if [[ ! -z "$2" ]] ; then level=$1 ; shift ; else level="info" ; fi

message=$1

if [[ -z "$rvm_interactive" ]] || [[ -z "$TERM" ]] || [[ "unknown" = "$TERM" ]] ; then
  case "$level" in
    debug) shift ; printf "\n$level: $message"     ;;
    info)  shift ; printf "\n$level: $message"     ;;
    warn)  shift ; printf "\n$level: $message"     ;;
    error) shift ; printf "\n$level: $message" >&2 ;;
    fail)  shift ; printf "\n$level: $message" >&2 ;;
    *) printf "$message"
  esac
else
  case "$level" in
    debug) shift ; printf "\n$(tput setaf 5)$message$(tput sgr0)"     ;;
    info)  shift ; printf "\n$(tput setaf 2)$message$(tput sgr0)"     ;;
    warn)  shift ; printf "\n$(tput setaf 3)$message$(tput sgr0)"     ;;
    error) shift ; printf "\n$(tput setaf 1)$message$(tput sgr0)" >&2 ;;
    fail)  shift ; printf "\n$(tput setaf 1)$message$(tput sgr0)" >&2 ;;
    *) printf "$message"
  esac
fi

exit 0

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rvm-0.1.35 scripts/log
rvm-0.1.34 scripts/log