GitLab's annual major release is around the corner. Along with a lot of new and exciting features, there will be a few breaking changes. Learn more here.

Verified Commit 8f217f7f authored by Erazem Kokot's avatar Erazem Kokot
Browse files

Make command output easier to read in log

parent 1f7780be
......@@ -8,12 +8,16 @@ export LOG_FILE
# Logging library, that appends its arguments (log messages) to the LOG_FILE
log() {
if [ -n "$1" ]; then
message="$1" # Manual log messages that use arguments (e.g. 'log "My message"')
echo "--- [$(date '+%H:%M:%S')]: ${message} ---" | tee -a "${LOG_FILE}"
# Manual logging
message="$1"
echo "[$(date '+%H:%M:%S')]: ${message}" | tee -a "${LOG_FILE}"
else
while read -r message; do # Command output
echo "[$(date '+%H:%M:%S')]: ${message}" | tee -a "${LOG_FILE}"
# Command output
echo "*** COMMAND OUTPUT ***" | tee -a "${LOG_FILE}"
while read -r message; do
echo "${message}" | tee -a "${LOG_FILE}"
done
echo "*** END OF COMMAND OUTPUT ***" | tee -a "${LOG_FILE}"
fi
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment