Sha256: 0eb8eb380c1ca95e3766e1fbb546f53ef8ca8d76475213b385d3a938c2634156

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

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
    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

1 entries across 1 versions & 1 rubygems

Version Path
rvm-1.0.7 scripts/log