#!/bin/bash
#
# printfunctions (raider print functions)
# This file is part of Raider

echoing() {		# Print messages in the screen
        local msg="$*"
        echo -e "${TAB_}${msg}"
}       

echoing_n() {		# Print messages as echo -n
        local msg="$*"
        echo -ne "${TAB_}${msg}"
}  

fatal_error() {		# print fatal error
	msg="$*"
  	echo -e "${TAB_}${cB}FATAL ERROR:${cEnd} ${msg}"	
  	if (check_root); then
		w=`basename ${BASH_SOURCE[1]}`
		echo "$1 [#${BASH_LINENO}:$w]" >> $LOGFILE 
	fi
}


logdivision() {		# print a division in log file
	repeatchar "-" 59 >> $LOGFILE
}

logging() {		# Print to logfile
    w=`basename ${BASH_SOURCE[1]}`
    if (check_root); then
    	echo "$1 [#${BASH_LINENO}:$w]" >> $LOGFILE
    fi
}

printdivision() {	# print a division in the screen
	repeatchar "-" 59
}

printfile() {		# print a file in the logfile
	# printfile "This is the message" "/path/file"
	local message=$1
	local filecat=$2
	echo >> $LOGFILE
	echo -e "$message" >> $LOGFILE
	logdivision
	cat $filecat >> $LOGFILE
	logdivision
	echo >> $LOGFILE
}

printerror() {		# Print error to screen
	local msg="$*"
	echo -e "${TAB_}${msg}"
}

printing() {		# Print to screen and logfile
	local msg="$*"
  	echo -e "${TAB_}${msg}"	
  	if (check_root); then
		w=`basename ${BASH_SOURCE[1]}`
		echo "$1 [#${BASH_LINENO}:$w]" >> $LOGFILE
	fi
}

printing_n() {		# Print to screen and logfile
	local msg="$*"
  	echo -en "${TAB_}${msg}"	
  	if (check_root); then
		w=`basename ${BASH_SOURCE[1]}`
		echo "$1 [#${BASH_LINENO}:$w]" >> $LOGFILE
	fi
}

