[dvblast-devel] [PATCH 17/20] dvblast: Add -g/--logger-ident parameter to set syslog ident.

Georgi Chorbadzhiyski gf at unixsol.org
Mon Sep 5 09:52:52 CEST 2011


By default dvblast uses program name (argv[0]) as syslog
ident. This is fine but a little hard to find. So in order
to be easier to choose syslog ident add -g/--logger-ident
parameters to resolve this. If one of the parameters is not
set argv[0] is used instead.
---
 dvblast.1 |    5 ++++-
 dvblast.c |   11 +++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dvblast.1 b/dvblast.1
index 7e965e0..c210a78 100644
--- a/dvblast.1
+++ b/dvblast.1
@@ -3,7 +3,7 @@
 DVBlast \- Simple and powerful dvb streaming application
 .SH SYNOPSIS
 .B dvblast
-[\fI-q\fR] \fI-c <config_file>\fR [\fI-r <remote_socket>\fR] [\fI-t <ttl>\fR] [\fI-o <SSRC_IP>\fR] [\fI-i <RT_priority>\fR] [\fI-a <adapter>\fR] [\fI-n <frontend number>\fR] [\fI-S <diseqc>\fR] \fI-f <frequency>\fR [\fI-F <fec inner>\fR] [\fI-R <rolloff>\fR] ] [\fI-s <symbol_rate>\fR] [\fI-v <0|13|18>\fR] [\fI-p\fR] [\fI-b <bandwidth>\fR] [\fI-m <modulation\fR] [\fI-u\fR] [\fI-W\fR] [\fI-U\fR] [\fI-d <dest_IP:port>\fR] [\fI-W\fR] [\fI-Y\fR] [\fI-e\fR] [\fI-T\fR] [\fI-l\fR]
+[\fI-q\fR] \fI-c <config_file>\fR [\fI-r <remote_socket>\fR] [\fI-t <ttl>\fR] [\fI-o <SSRC_IP>\fR] [\fI-i <RT_priority>\fR] [\fI-a <adapter>\fR] [\fI-n <frontend number>\fR] [\fI-S <diseqc>\fR] \fI-f <frequency>\fR [\fI-F <fec inner>\fR] [\fI-R <rolloff>\fR] ] [\fI-s <symbol_rate>\fR] [\fI-v <0|13|18>\fR] [\fI-p\fR] [\fI-b <bandwidth>\fR] [\fI-m <modulation\fR] [\fI-u\fR] [\fI-W\fR] [\fI-U\fR] [\fI-d <dest_IP:port>\fR] [\fI-W\fR] [\fI-Y\fR] [\fI-e\fR] [\fI-T\fR] [\fI-l\fR] [\fI-g <logger_ident>\fR]
 .SH DESCRIPTION
 DVBlast is a simple and powerful streaming application based on the linux-dvb API.
 It opens a DVB device, tunes it, places PID filters, configures a CAM module, and demultiplexes the packets to several RTP outputs.
@@ -84,6 +84,9 @@ DVB-T low priority FEC (default auto)
 \fB\-l\fR, \fB\-\-logger\fR
 Send messages to syslog instead of stderr
 .TP
+\fB\-g\fR, \fB\-\-logger-ident\fR <logger_ident>
+Set the program name that will appear in syslog (default: dvblast /the executable name/).
+.TP
 \fB\-L\fR, \fB\-\-latency\fR <latency>
 Maximum latency allowed between input and output (default: 100 ms)
 .TP
diff --git a/dvblast.c b/dvblast.c
index 65a0e1c..73cbd5f 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -98,6 +98,7 @@ volatile sig_atomic_t b_conf_reload = 0;
 volatile sig_atomic_t b_exit_now = 0;
 int i_verbose = DEFAULT_VERBOSITY;
 int i_syslog = 0;
+char *psz_syslog_ident = NULL;
 
 bool b_enable_emm = false;
 bool b_enable_ecm = false;
@@ -465,6 +466,7 @@ void usage()
     msg_Raw( NULL, "  -j --system-charset   character set used for printing messages (default UTF-8)" );
     msg_Raw( NULL, "  -J --dvb-charset      character set used in output DVB tables (default ISO_8859-1)" );
     msg_Raw( NULL, "  -l --logger           use syslog for logging messages instead of stderr" );
+    msg_Raw( NULL, "  -g --logger-ident     program name that will be used in syslog messages" );
     msg_Raw( NULL, "  -x --print            print interesting events on stdout in a given format" );
     msg_Raw( NULL, "  -q --quiet            be quiet (less verbosity, repeat or use number for even quieter)" );
     msg_Raw( NULL, "  -Q --quit-timeout     when locked, quit after this delay (in ms), or after the first lock timeout" );
@@ -536,6 +538,7 @@ int main( int i_argc, char **pp_argv )
         { "system-charset",  required_argument, NULL, 'j' },
         { "dvb-charset",     required_argument, NULL, 'J' },
         { "logger",          no_argument,       NULL, 'l' },
+        { "logger-ident",    required_argument, NULL, 'g' },
         { "print",           required_argument, NULL, 'x' },
         { "quit-timeout",    required_argument, NULL, 'Q' },
         { "quiet",           no_argument,       NULL, 'q' },
@@ -545,7 +548,7 @@ int main( int i_argc, char **pp_argv )
         { 0, 0, 0, 0 }
     };
 
-    while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:f:F:R:s:S:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lzCWYeM:N:j:J:x:Q:hVZ:", long_options, NULL)) != -1 )
+    while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:f:F:R:s:S:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lg:zCWYeM:N:j:J:x:Q:hVZ:", long_options, NULL)) != -1 )
     {
         switch ( c )
         {
@@ -781,6 +784,10 @@ int main( int i_argc, char **pp_argv )
             b_enable_syslog = 1;
             break;
 
+        case 'g':
+            psz_syslog_ident = optarg;
+            break;
+
         case 'x':
             if ( !strcmp(optarg, "text") )
                 i_print_type = PRINT_TEXT;
@@ -813,7 +820,7 @@ int main( int i_argc, char **pp_argv )
         usage();
 
     if ( b_enable_syslog )
-        msg_Connect( pp_argv[0] );
+        msg_Connect( psz_syslog_ident ? psz_syslog_ident : pp_argv[0] );
 
     if ( i_verbose )
         DisplayVersion();
-- 
1.7.5.1



More information about the dvblast-devel mailing list