[dvblast-devel] Patch for log output. Added date_time output.

Kompan Kolia kompan at yandex.ru
Mon Feb 29 11:45:41 CET 2016


Hello.

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
--


More information about the dvblast-devel mailing list