#!/usr/bin/env bash

# Logging functions

# Detect wheter or not the shell is interactive.
if [[ -t 0 ]]
then
  eval "rvm_log()   { printf \"\$(tput setaf 2)\$*\$(tput sgr0)\n\" ; }"
  eval "rvm_debug() { printf \"\$(tput setaf 5)DEBUG: \$*\$(tput sgr0)\n\" ; }"
  eval "rvm_warn()  { printf \"\$(tput setaf 3)WARN: \$*\$(tput sgr0)\n\" ; }"
  eval "rvm_error() { printf \"\$(tput setaf 1)ERROR: \$*\$(tput sgr0)\n\" >&2 ; }"
else
  rvm_log()   { printf "$*\n" ; }
  rvm_debug() { printf "DEBUG: $*\n" ; }
  rvm_warn()  { printf "WARN: $*\n" ; }
  rvm_error() { printf "ERROR: $*\n" >&2 ; }
fi

