Modified logging so that even on NPTL systems each line in the log file shows the individual thread's pid

This commit is contained in:
Klaus Schmidinger
2006-01-15 16:42:37 +01:00
parent a321947e47
commit 29501203f7
5 changed files with 28 additions and 7 deletions

15
tools.c
View File

@@ -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)) +