#!/bin/bash

# This file contains functions used for writing log messages
# to stdout and stderr from scripts while they run.

# os::log::info writes the message to stdout.
#
# Arguments:
#  - all: message to write
function os::log::info() {
	echo "[INFO] $*"
}
readonly -f os::log::info

# os::log::warn writes the message to stderr.
# A warning indicates something went wrong but
# not so wrong that we cannot recover.
#
# Arguments:
#  - all: message to write
function os::log::warn() {
	os::text::print_yellow "[WARNING] $*\n" 1>&2
}
readonly -f os::log::warn

# os::log::error writes the message to stderr.
# An error indicates that something went wrong
# and we will most likely fail after this.
#
# Arguments:
#  - all: message to write
function os::log::error() {
	os::text::print_red "[ERROR] $*\n" 1>&2
}
readonly -f os::log::error

# os::log::fatal writes the message to stderr and
# returns a non-zero code to force a process exit.
# A fatal error indicates that there is no chance
# of recovery.
#
# Arguments:
#  - all: message to write
function os::log::fatal() {
	os::text::print_red "[FATAL] $*\n" 1>&2
	return 1
}
readonly -f os::log::fatal
#!/bin/bash

# This file contains functions used for writing log messages
# to stdout and stderr from scripts while they run.

# os::log::info writes the message to stdout.
#
# Arguments:
#  - all: message to write
function os::log::info() {
	echo "[INFO] $*"
}
readonly -f os::log::info

# os::log::warn writes the message to stderr.
# A warning indicates something went wrong but
# not so wrong that we cannot recover.
#
# Arguments:
#  - all: message to write
function os::log::warn() {
	os::text::print_yellow "[WARNING] $*" 1>&2
}
readonly -f os::log::warn

# os::log::error writes the message to stderr.
# An error indicates that something went wrong
# and we will most likely fail after this.
#
# Arguments:
#  - all: message to write
function os::log::error() {
	os::text::print_red "[ERROR] $*" 1>&2
}
readonly -f os::log::error

# os::log::fatal writes the message to stderr and
# returns a non-zero code to force a process exit.
# A fatal error indicates that there is no chance
# of recovery.
#
# Arguments:
#  - all: message to write
function os::log::fatal() {
	os::text::print_red "[FATAL] $*" 1>&2
	return 1
}
readonly -f os::log::fatal
Remove uninterpreted newline literal from logging functions
Remove uninterpreted newline literal from logging functions

When the logging functions were switched to use `echo` instead
of `printf` the literal newline that was necessary with `printf`
was not removed. This commit remedies that oversight.

Signed-off-by: Steve Kuznetsov <a7da0fca91d9933d2725d731a48cabdc9e8ffd7a@redhat.com>
