1
0

prefix-log 369 B

123456789101112
  1. #!/bin/bash
  2. #
  3. # Prefixes all lines on stdout and stderr with the process name (as determined by
  4. # the SUPERVISOR_PROCESS_NAME env var, which is automatically set by Supervisor).
  5. #
  6. # Usage:
  7. # prefix-log command [args...]
  8. #
  9. exec 1> >(awk '{print "'"${SUPERVISOR_PROCESS_NAME}"' | "$0}' >&1)
  10. exec 2> >(awk '{print "'"${SUPERVISOR_PROCESS_NAME}"' | "$0}' >&2)
  11. exec "$@"