summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2006-01-15 16:42:37 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2006-01-15 16:42:37 +0100
commit29501203f7b6818258d438d8826ac02c60e08494 (patch)
treeb475981275e4016426cd89bd456b59234d1f45a2 /tools.c
parenta321947e4713535af2cb1944bb7d6bc1688b6e50 (diff)
downloadvdr-29501203f7b6818258d438d8826ac02c60e08494.tar.gz
vdr-29501203f7b6818258d438d8826ac02c60e08494.tar.bz2
Modified logging so that even on NPTL systems each line in the log file shows the individual thread's pid
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools.c b/tools.c
index 33b2ec62..85fd4061 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.110 2006/01/15 14:31:45 kls Exp $
+ * $Id: tools.c 1.111 2006/01/15 16:42:37 kls Exp $
*/
#include "tools.h"
@@ -26,9 +26,22 @@ extern "C" {
#include <unistd.h>
#include <utime.h>
#include "i18n.h"
+#include "thread.h"
int SysLogLevel = 3;
+#define MAXSYSLOGBUF 256
+
+void syslog_with_tid(int priority, const char *format, ...)
+{
+ va_list ap;
+ char fmt[MAXSYSLOGBUF];
+ snprintf(fmt, sizeof(fmt), "[%d] %s", cThread::ThreadId(), format);
+ va_start(ap, format);
+ vsyslog(priority, fmt, ap);
+ va_end(ap);
+}
+
int BCD2INT(int x)
{
return ((1000000 * BCDCHARTOINT((x >> 24) & 0xFF)) +