summary refs log tree commit diff
path: root/docker/prefix-log
blob: 0e26a4f19d33d90efd192c4d74c0df1f9c31aaab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
#
# Prefixes all lines on stdout and stderr with the process name (as determined by
# the SUPERVISOR_PROCESS_NAME env var, which is automatically set by Supervisor).
#
# Usage:
#   prefix-log command [args...]
#

exec 1> >(awk '{print "'"${SUPERVISOR_PROCESS_NAME}"' | "$0}' >&1)
exec 2> >(awk '{print "'"${SUPERVISOR_PROCESS_NAME}"' | "$0}' >&2)
exec "$@"