Sha256: 0c7a8e94945837767ad341a3cadb92351afec5555781149322ab625ee02c37cf

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 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="$(echo "$1" | sed 's/%/%%/g')"

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

exit 0

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rvm-1.0.2 scripts/log
rvm-1.0.1 scripts/log