logger: add support for -I PID to log, e.g., $$ from a shell script

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2022-07-31 12:03:57 +02:00
parent f32ca837c1
commit 4f94756bf2
4 changed files with 26 additions and 3 deletions

View File

@@ -38,6 +38,7 @@
.Op Fl f Ar FILE
.Op Fl h Ar HOST
.Op Fl H Ar HOSTNAME
.Op Fl I Ar PID
.Op Fl m Ar MSGID
.Op Fl p Ar PRIO
.Op Fl P Ar PORT
@@ -105,6 +106,16 @@ will be used.
Send the message to the remote system
.Ar host
instead of logging it locally.
.It Fl I Ar PID
Like
.Fl i ,
but uses
.Ar PID .
Useful when logging from shell scripts that send multiple messages.
E.g., the following arguments might be a useful template:
.Bd -literal -offset indent
logger -t $(basename $0) -I $$
.Ed
.It Fl i
Log the process id of the logger process with each line
.Ql ( LOG_PID ) .