diff --git a/bin/cget.sh b/bin/cget.sh index 10149db..89b06c9 100755 --- a/bin/cget.sh +++ b/bin/cget.sh @@ -152,6 +152,11 @@ fi # Process command-line options and arguments ####################################################################### +# default to INFO logging +if [ -z "$LOG_LEVEL" ]; then + LOG_LEVEL=3 +fi + help_mode=false; verbose_mode=false; quiet_mode=false; local_opts= while getopts ":hvqFC" opt; do case $opt in @@ -161,11 +166,13 @@ while getopts ":hvqFC" opt; do v) verbose_mode=true quiet_mode=false + LOG_LEVEL=4 local_opts="$local_opts -$opt" ;; q) verbose_mode=false quiet_mode=true + LOG_LEVEL=0 ;; F) local_opts="$local_opts -$opt" @@ -201,14 +208,6 @@ location="$1" # Initialization ####################################################################### -# determine the log file -if $quiet_mode; then - log_file=/dev/null -else - log_file="$CACHE_DIR/cget_log.txt" - local_opts="$local_opts -L $log_file" -fi - # create temporary subdirectory /bin/mkdir "$tmp_dir" status_code=$? @@ -216,7 +215,7 @@ if [ $status_code -ne 0 ]; then echo "ERROR: $script_name failed to create tmp dir ($status_code) $tmp_dir" >&2 exit 2 fi -$verbose_mode && print_log_message -D "$script_name creating temp dir: $tmp_dir" "$log_file" +$verbose_mode && print_log_message -D "$script_name creating temp dir: $tmp_dir" # temporary file tmp_file="${tmp_dir}/http_resource_$$" @@ -228,7 +227,7 @@ tmp_file="${tmp_dir}/http_resource_$$" # Functions print_log_message and clean_up_and_exit defined in core_lib.sh # Function conditional_get defined in http_tools.sh -print_log_message "$script_name requesting resource: $location" "$log_file" +print_log_message "$script_name requesting resource: $location" # get the resource conditional_get $local_opts -d "$CACHE_DIR" -T "$tmp_dir" "$location" > "$tmp_file"