Sha256: f1f18f619421410c8ad95f0d459afed8064344092b439a01e82e425054368015

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 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//%/%%}"

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

  case "$level" in
    debug|info|warn) printf "$message\n"     ;;
    error|fail) printf "$message\n" >&2 ;;
    *) printf "$message"
  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"
  esac
fi

exit 0

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rvm-1.0.4 scripts/log
rvm-1.0.3 scripts/log