Skip to content

Commit

Permalink
always log to stderr to avoid breaking pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
shizunge committed Dec 30, 2023
1 parent 6e4fef3 commit f8cac1f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/lib-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ log_formatter() {
SCOPE_STR=$(if [ -n "${SCOPE}" ]; then echo "${SCOPE}: "; else echo ""; fi);
MESSAGE_STR=$(echo "${*}" | tr '\n' ' ')
local MESSAGE="[${TIME}]${LOCATION_STR}[${LEVEL}] ${SCOPE_STR}${MESSAGE_STR}";
if [ "${LEVEL}" = "ERROR" ]; then
echo "${MESSAGE}" >&2;
else
echo "${MESSAGE}";
fi;
echo "${MESSAGE}" >&2;
}

# We want to print an empty line for log without an argument. Thus we do not run the following check.
Expand Down

0 comments on commit f8cac1f

Please sign in to comment.