mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
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:
parent
a321947e47
commit
29501203f7
@ -1659,3 +1659,7 @@ J
|
||||
Jesus Bravo Alvarez <jba@pobox.com>
|
||||
for reporting a second place where a message should be given when an instant
|
||||
recording is started
|
||||
|
||||
Francois-Xavier Kowalski <francois-xavier.kowalski@hp.com>
|
||||
for suggesting how to modify logging so that even on NPTL systems each line in
|
||||
the log file shows the individual thread's pid
|
||||
|
2
HISTORY
2
HISTORY
@ -4194,3 +4194,5 @@ Video Disk Recorder Revision History
|
||||
|
||||
- Fixed a second place where a message should be given when an instant recording
|
||||
is started (reported by Jesus Bravo Alvarez).
|
||||
- Modified logging so that even on NPTL systems each line in the log file shows
|
||||
the individual thread's pid (based on a suggestion from Francois-Xavier Kowalski).
|
||||
|
15
tools.c
15
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)) +
|
||||
|
10
tools.h
10
tools.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: tools.h 1.89 2006/01/08 11:40:37 kls Exp $
|
||||
* $Id: tools.h 1.90 2006/01/15 16:19:56 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __TOOLS_H
|
||||
@ -26,9 +26,9 @@ typedef unsigned long long int uint64;
|
||||
|
||||
extern int SysLogLevel;
|
||||
|
||||
#define esyslog(a...) void( (SysLogLevel > 0) ? syslog(LOG_ERR, a) : void() )
|
||||
#define isyslog(a...) void( (SysLogLevel > 1) ? syslog(LOG_INFO, a) : void() )
|
||||
#define dsyslog(a...) void( (SysLogLevel > 2) ? syslog(LOG_DEBUG, a) : void() )
|
||||
#define esyslog(a...) void( (SysLogLevel > 0) ? syslog_with_tid(LOG_ERR, a) : void() )
|
||||
#define isyslog(a...) void( (SysLogLevel > 1) ? syslog_with_tid(LOG_INFO, a) : void() )
|
||||
#define dsyslog(a...) void( (SysLogLevel > 2) ? syslog_with_tid(LOG_DEBUG, a) : void() )
|
||||
|
||||
#define LOG_ERROR esyslog("ERROR (%s,%d): %m", __FILE__, __LINE__)
|
||||
#define LOG_ERROR_STR(s) esyslog("ERROR: %s: %m", s)
|
||||
@ -52,6 +52,8 @@ template<class T> inline int sgn(T a) { return a < 0 ? -1 : a > 0 ? 1 : 0; }
|
||||
template<class T> inline void swap(T &a, T &b) { T t = a; a = b; b = t; }
|
||||
#endif
|
||||
|
||||
void syslog_with_tid(int priority, const char *format, ...);
|
||||
|
||||
#define BCDCHARTOINT(x) (10 * ((x & 0xF0) >> 4) + (x & 0xF))
|
||||
int BCD2INT(int x);
|
||||
|
||||
|
4
vdr.c
4
vdr.c
@ -22,7 +22,7 @@
|
||||
*
|
||||
* The project's page is at http://www.cadsoft.de/vdr
|
||||
*
|
||||
* $Id: vdr.c 1.239 2006/01/15 16:01:32 kls Exp $
|
||||
* $Id: vdr.c 1.240 2006/01/15 16:23:21 kls Exp $
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
@ -447,7 +447,7 @@ int main(int argc, char *argv[])
|
||||
// Log file:
|
||||
|
||||
if (SysLogLevel > 0)
|
||||
openlog("vdr", LOG_PID | LOG_CONS, SysLogTarget);
|
||||
openlog("vdr", LOG_CONS, SysLogTarget); // LOG_PID doesn't work as expected under NPTL
|
||||
|
||||
// Check the video directory:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user