[dvblast-devel] dvblast loggin to syslog

Вячеслав Адаманов adamanov at gmail.com
Thu Aug 25 16:35:29 CEST 2011


Last your proposal is flexible enough!

2011/8/25 Вячеслав Адаманов <adamanov at gmail.com>

> May be  set ident name based on Input param -a or -A or -D ?
>
> 2011/8/25 Georgi Chorbadzhiyski <gf at unixsol.org>
>
>> Around 08/25/2011 04:07 PM, Georgi Chorbadzhiyski scribbled:
>> > Around 08/25/2011 03:44 PM, Вячеслав Адаманов scribbled:
>> >> There are a couple of proposals for logging events in dvblast.
>> >> When you run multiple copies dvblast on different DVB cards to
>> determine
>> >> which copies can only PID of the process, it is not convenient if using
>> >> remote syslog.
>> >
>> > It seems from reading the code that syslog ident is set from the
>> executable name.
>> > (see dvblast.c around line 812), so if you run dvblast with different
>> names (you
>> > may use symlinks) you'll have messages from each dvblast easily
>> recognizable.
>>
>> Or you may use something like the attached that allows to set syslog ident
>> by
>> using --logger-ident or -g command line parameters.
>>
>> --
>> Georgi Chorbadzhiyski
>> http://georgi.unixsol.org/
>>
>> diff --git a/dvblast.c b/dvblast.c
>> index 7cd6c7e..bca3b1d 100644
>> --- a/dvblast.c
>> +++ b/dvblast.c
>> @@ -97,6 +97,7 @@ print_type_t i_print_type = -1;
>>  volatile sig_atomic_t b_hup_received = 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;
>> @@ -461,6 +462,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" );
>> @@ -532,6 +534,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' },
>> @@ -541,7 +544,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 )
>>         {
>> @@ -777,6 +780,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;
>> @@ -809,7 +816,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();
>>
>>
>
>
> --
> __________________________
> Vyacheslav Adamanov
> 87500, Ukraine, Mariupol,
> st. Apatova 136а
> mob: +38 (067) 621 32 61
> email: adamanov at gmail.com
> www: http://hl.ua
>



-- 
__________________________
Vyacheslav Adamanov
87500, Ukraine, Mariupol,
st. Apatova 136а
mob: +38 (067) 621 32 61
email: adamanov at gmail.com
www: http://hl.ua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/dvblast-devel/attachments/20110825/548defc1/attachment.html>


More information about the dvblast-devel mailing list