includes error messages); the reasoning being that timing information
may be especially useful when debugging it.
The server logs to syslog, which already has timestamps.
Other programs could easily have this feature enabled if necessary.
.ai_protocol = IPPROTO_UDP
};
.ai_protocol = IPPROTO_UDP
};
+ /* Timing information is often important to debugging playrtp, so we include
+ * timestamps in the logs */
+ logdate = 1;
mem_init();
if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
backend = uaudio_apis[0];
mem_init();
if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
backend = uaudio_apis[0];
#include <errno.h>
#include <syslog.h>
#include <sys/time.h>
#include <errno.h>
#include <syslog.h>
#include <sys/time.h>
#include "log.h"
#include "disorder.h"
#include "log.h"
#include "disorder.h"
/** @brief Filename for debug messages */
const char *debug_filename;
/** @brief Filename for debug messages */
const char *debug_filename;
+/** @brief Set to include timestamps in log messages */
+int logdate;
+
/** @brief Line number for debug messages */
int debug_lineno;
/** @brief Line number for debug messages */
int debug_lineno;
if(progname)
fprintf(fp, "%s: ", progname);
if(progname)
fprintf(fp, "%s: ", progname);
+ if(logdate) {
+ char timebuf[64];
+ struct tm *tm;
+ gettimeofday(&tv, 0);
+ tm = localtime(&tv.tv_sec);
+ strftime(timebuf, sizeof timebuf, "%Y-%m-%d %H:%M:%S %Z", tm);
+ fprintf(fp, "%s: ", timebuf);
+ }
if(pri <= LOG_ERR)
fputs("ERROR: ", fp);
else if(pri < LOG_DEBUG)
if(pri <= LOG_ERR)
fputs("ERROR: ", fp);
else if(pri < LOG_DEBUG)
extern const char *debug_filename;
extern int debug_lineno;
extern const char *debug_filename;
extern int debug_lineno;
#define D(x) do { \
if(debugging) { \
#define D(x) do { \
if(debugging) { \