[dvblast-devel] Patch for log output. Added date_time output.
Georgi Chorbadzhiyski
gf at unixsol.org
Mon Feb 29 18:45:52 CET 2016
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/
More information about the dvblast-devel
mailing list