Merge branch 'debug_add_timestamp' into 'master'

add timestamp to debug outputs

See merge request sane-project/backends!228
merge-requests/255/merge
Rolf Bensch 2019-12-04 16:10:27 +00:00
commit 4156fae159
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -58,6 +58,8 @@
#include <sys/socket.h>
#endif
#include <sys/stat.h>
#include <time.h>
#include <sys/time.h>
#ifdef HAVE_OS2_H
# define INCL_DOS
@ -148,7 +150,13 @@ sanei_debug_msg
}
else
{
fprintf (stderr, "[%s] ", be);
struct timeval tv;
struct tm *t;
gettimeofday (&tv, NULL);
t = localtime (&tv.tv_sec);
fprintf (stderr, "[%02d:%02d:%02d.%06ld] [%s] ", t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec, be);
vfprintf (stderr, fmt, ap);
}