summary refs log tree commit diff
path: root/docker/prefix-log
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-04-27 14:39:41 +0100
committerGitHub <noreply@github.com>2022-04-27 14:39:41 +0100
commitd743b25c8f0c96516d9c374ee946e93e937e2c5b (patch)
tree37ab35448d2e3ebd6a1734cc1f53afc9d1df40b6 /docker/prefix-log
parentMake `scripts-dev` pass `mypy --disallow-untyped-defs` (#12356) (diff)
downloadsynapse-d743b25c8f0c96516d9c374ee946e93e937e2c5b.tar.xz
Use supervisord to supervise Postgres and Caddy in the Complement image. (#12480)
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Diffstat (limited to '')
-rwxr-xr-xdocker/prefix-log12
1 files changed, 12 insertions, 0 deletions
diff --git a/docker/prefix-log b/docker/prefix-log
new file mode 100755
index 0000000000..0e26a4f19d
--- /dev/null
+++ b/docker/prefix-log
@@ -0,0 +1,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 "$@"