#!/bin/bash
#########################################################
# 							#
# This is BashStyle-NG					#
#							#
# Licensed under GNU GENERAL PUBLIC LICENSE v3    	#
#							#
# Copyright 2007 - 2011 Christopher Bratusek		#
#							#
#########################################################

verbose=$(get_key debug_verbose)

dbg_msg ()
{
	if [[ ! $BSNG_RC_GEN ]]; then
		if [[ $verbose == true ]]; then
			echo -e "$@" | tee -a $BSNG_LOGFILE
		else	echo -e "$@" >> $BSNG_LOGFILE
		fi
	fi

}

dbg_log ()
{

	"$@" > >(tee -a $BSNG_LOGFILE) 2>&1

}

dbg_finalize()
{

	sed '$!N; /^\(.*\)\n\1$/!P; D' -i $BSNG_LOGFILE

}

dbg_view ()
{

	cat $BSNG_LOGFILE | less

}

dbg_verbosity ()
{

	if [[ $1 == "true" ]]; then
		set_key bool debug_verbose true
	elif [[ $1 == "false" ]]; then
		set_key bool debug_verbose false
	fi

}
