Sha256: 568cf09feb8ddae31809e41199284c28a0a25a60f2bee5dc5f76c6b2304737f6

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/env bash

# When rvm_silence_logging is set, don't show anything.
[[ -n "$rvm_silence_logging" ]] && exit 0

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 [[ ${rvm_pretty_print_flag:-0} -eq 0 ]] ; then

  if [[ ${rvm_verbose_flag:-0} -gt 0 && -n "$level" ]] ; then
    message="$level: $message"
  fi

  case "$level" in
    info)       printf -- "${message#*: }\n" ;;
    debug|warn) printf -- "$message\n" ;;
    error|fail) printf -- "$message\n" >&2  ;;
    *) printf "$message\n"
  esac

else

  case "$level" in
    debug) printf -- "$(tput setaf 5)$level$(tput sgr0): $message\n"     ;;
    info)  printf -- "$(tput setaf 2)$level$(tput sgr0): $message\n"     ;;
    warn)  printf -- "$(tput setaf 3)$level$(tput sgr0): $message\n"     ;;
    error) printf -- "$(tput setaf 1)$level$(tput sgr0): $message\n" >&2 ;;
    fail)  printf -- "$(tput setaf 1)$level$(tput sgr0): $message\n" >&2 ;;
    *)     printf -- "$message\n"
  esac

fi

exit 0

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rvm-1.1.4 scripts/log
rvm-1.1.3 scripts/log
rvm-1.1.2 scripts/log
rvm-1.1.1 scripts/log
rvm-1.1.0 scripts/log
rvm-1.0.23 scripts/log
rvm-1.0.22 scripts/log