Skip to content

Commit

Permalink
feat: Adapt log format if journald is detected
Browse files Browse the repository at this point in the history
* Journald has already informations such as hostname or datetime
  • Loading branch information
riton authored and struanb committed Jan 18, 2024
1 parent 54bde9c commit 0df1c86
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docker-ingress-routing-daemon
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ VERSION=4.1.1
# Workaround for https://github.com/moby/moby/issues/25526

log() {
if [ -n "${JOURNAL_STREAM}" ]
then
# Launched with systemd and journald
echo "$@"
return
fi

[ -z "$_BASHPID" ] && _BASHPID="$BASHPID"
local D=$(date +%Y-%m-%d.%H:%M:%S.%N)
local S=$(printf "%s|%s|%05d|" "${D:0:26}" "$HOSTNAME" "$_BASHPID")
Expand Down

0 comments on commit 0df1c86

Please sign in to comment.