From 06c1ad4f8b54affde57d928c9557034969c36e21 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Sun, 25 Aug 2019 13:37:01 +0200 Subject: vlogger: force to use syslog if message arguments are given --- vlogger.8 | 40 +++++++++++++++++++++++++++++----------- vlogger.c | 3 +++ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/vlogger.8 b/vlogger.8 index 820cf3b..b7919d9 100644 --- a/vlogger.8 +++ b/vlogger.8 @@ -12,17 +12,35 @@ .Op Fl t Ar tag .Op Ar message ... .Sh DESCRIPTION -By default, +The .Nm -reads lines from +utility writes messages to the system log. +.Pp +With +.Ar message +arguments +.Nm +will always write messages to the system log. +Without +.Ar message +arguments +.Nm +reads messages from .Dv stdin -and sends them to syslog. -If the file +or the file specified with the +.Fl f +flag. +If the .Pa /etc/vlogger -exists and is executable it is executed with -.Ar tag -as only argument and replaces -.Nm . +executable exists +.Nm +executes it with +.Ar tag , +level +and priority as arguments, +replacing the +.Nm +process. .Pp If .Nm @@ -34,10 +52,10 @@ supervision suite it uses the service name as default As example if .Nm is linked to -.Dv /var/service/foo/log/run +.Pa /var/service/foo/log/run it uses -.Dv foo -as default +.Dq foo +as .Ar tag . .Pp The options are as follows: diff --git a/vlogger.c b/vlogger.c index c886239..64f1a2e 100644 --- a/vlogger.c +++ b/vlogger.c @@ -119,6 +119,9 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if (argc > 0) + Sflag++; + if (!Sflag && access("/etc/vlogger", X_OK) != -1) { CODE *cp; const char *sfacility = "", *slevel = ""; -- cgit 1.4.1