[dvblast-devel] Patch for log output. Added date_time output.
Kompan Kolia
kompan at yandex.ru
Wed Mar 2 13:44:51 CET 2016
FYI, not all messages redirected to syslog when I use "-l" options.
DVBlast 3.1 (release) - (msg_raw)
CAM none - (fprintf)
lock status: 1 - (fprintf)
It would be great if all messages redirect to syslog.
29.02.2016, 20:45, "Georgi Chorbadzhiyski" <gf at unixsol.org>:
> On 2/29/16 12:45 PM, Kompan Kolia wrote:
>> Can you add this patch in main tree of DVBlast ?
>>
>> This patch add Date_time logging for dvblast output.
>>
>> --- util.c 2016-02-08 21:39:40.000000000 +0300
>> +++ util.c 2016-02-29 13:31:13.237674077 +0300
>> @@ -39,6 +39,8 @@
>> #include <bitstream/mpeg/psi.h>
>>
>> #include "dvblast.h"
>> +#include <stdio.h>
>> +#include <time.h>
>>
>> /*****************************************************************************
>> * Local declarations
>> @@ -137,8 +139,13 @@
>>
>> if ( !i_syslog )
>> {
>> + char buff[20];
>> + struct tm *sTm;
>> + time_t now = time (0);
>> + sTm = localtime (&now);
>> char psz_fmt[MAX_MSG];
>> - snprintf( psz_fmt, MAX_MSG, "info: %s\n", psz_format );
>> + strftime (buff, sizeof(buff), "%Y-%m-%d %H:%M:%S", sTm);
>> + snprintf( psz_fmt, MAX_MSG, "%s info: %s\n", buff, psz_format );
>> vfprintf( stderr, psz_fmt, args );
>> }
>> else
>> @@ -162,8 +169,13 @@
>>
>> if ( !i_syslog )
>> {
>> + char buff[20];
>> + struct tm *sTm;
>> + time_t now = time (0);
>> + sTm = localtime (&now);
>> char psz_fmt[MAX_MSG];
>> - snprintf( psz_fmt, MAX_MSG, "error: %s\n", psz_format );
>> + strftime (buff, sizeof(buff), "%Y-%m-%d %H:%M:%S", sTm);
>> + snprintf( psz_fmt, MAX_MSG, "%s error: %s\n", buff, psz_format );
>> vfprintf( stderr, psz_fmt, args );
>> }
>> else
>> @@ -187,8 +199,13 @@
>>
>> if ( !i_syslog )
>> {
>> + char buff[20];
>> + struct tm *sTm;
>> + time_t now = time (0);
>> + sTm = localtime (&now);
>> char psz_fmt[MAX_MSG];
>> - snprintf( psz_fmt, MAX_MSG, "warning: %s\n", psz_format );
>> + strftime (buff, sizeof(buff), "%Y-%m-%d %H:%M:%S", sTm);
>> + snprintf( psz_fmt, MAX_MSG, "%s warning: %s\n", buff, psz_format );
>> vfprintf( stderr, psz_fmt, args );
>> }
>> else
>> @@ -212,8 +229,13 @@
>>
>> if ( !i_syslog )
>> {
>> + char buff[20];
>> + struct tm *sTm;
>> + time_t now = time (0);
>> + sTm = localtime (&now);
>> char psz_fmt[MAX_MSG];
>> - snprintf( psz_fmt, MAX_MSG, "debug: %s\n", psz_format );
>> + strftime (buff, sizeof(buff), "%Y-%m-%d %H:%M:%S", sTm);
>> + snprintf( psz_fmt, MAX_MSG, "%s debug: %s\n", buff, psz_format );
>> vfprintf( stderr, psz_fmt, args );
>> }
>> else
>
> I'm quite happy using stdout output piped to syslog or something like that.
>
> Adding this patch would be a step backwards IMHO.
>
> --
> Georgi Chorbadzhiyski | http://georgi.unixsol.org/ | http://github.com/gfto/
> _______________________________________________
> dvblast-devel mailing list
> dvblast-devel at videolan.org
> https://mailman.videolan.org/listinfo/dvblast-devel
More information about the dvblast-devel
mailing list