diff options
| author | Paul Buetow <paul@buetow.org> | 2022-01-03 10:48:58 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-01-03 10:49:53 +0000 |
| commit | 8caa976ca4c5dd4b399d02ebc198d3a9db1e7bdb (patch) | |
| tree | 2dbe8868b7400bcc13c6a82b98ac204f081e076d /lib/log.source.sh | |
| parent | 7f3318ecab9b9ffedc47e0a9d247dc5fdf9b2893 (diff) | |
lock concurrent git commands. also log bash pid.
Diffstat (limited to 'lib/log.source.sh')
| -rw-r--r-- | lib/log.source.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/log.source.sh b/lib/log.source.sh index 56c6587..2feb119 100644 --- a/lib/log.source.sh +++ b/lib/log.source.sh @@ -5,17 +5,18 @@ log () { for message in "$@"; do echo "$message" - done | log::_pipe "$level" + done | log::_pipe "$level" $$ } # Log a stream through a pipe. log::pipe () { - log::_pipe "$1" + log::_pipe "$1" $$ } # Internal log implementation. log::_pipe () { local -r level="$1"; shift + local -r pid="$1"; shift if [[ "$level" == VERBOSE && -z "$LOG_VERBOSE" ]]; then return @@ -25,6 +26,6 @@ log::_pipe () { local -r stamp=$($DATE +%Y%m%d-%H%M%S) while read -r line; do - echo "$level|$stamp|$callee|$line" >&2 + echo "$level|$stamp|$pid|$callee|$line" >&2 done } |
