Add DEBUGLOG() macro for debuglogging (will only output if tvheadend is started with '-d')
This commit is contained in:
parent
87f4c5e280
commit
b8948fc488
2 changed files with 13 additions and 1 deletions
|
@ -63,6 +63,7 @@ pthread_mutex_t global_lock;
|
|||
pthread_mutex_t ffmpeg_lock;
|
||||
static int log_stderr;
|
||||
static int log_decorate;
|
||||
int log_debug;
|
||||
|
||||
static void
|
||||
handle_sigpipe(int x)
|
||||
|
@ -163,6 +164,7 @@ usage(const char *argv0)
|
|||
" it will allow world-wide administrative access\n"
|
||||
" to your Tvheadend installation until you edit\n"
|
||||
" the access-control from within the Tvheadend UI\n");
|
||||
printf(" -d Debug logging");
|
||||
printf("\n");
|
||||
printf("For more information read the man page or visit\n");
|
||||
printf(" http://www.lonelycoder.com/hts/\n");
|
||||
|
@ -227,7 +229,7 @@ main(int argc, char **argv)
|
|||
const char *contentpath = TVHEADEND_CONTENT_PATH;
|
||||
const char *homedir = NULL;
|
||||
|
||||
while((c = getopt(argc, argv, "fu:g:c:Ch")) != -1) {
|
||||
while((c = getopt(argc, argv, "fu:g:c:Chd")) != -1) {
|
||||
switch(c) {
|
||||
case 'f':
|
||||
forkaway = 1;
|
||||
|
@ -241,6 +243,9 @@ main(int argc, char **argv)
|
|||
case 'c':
|
||||
contentpath = optarg;
|
||||
break;
|
||||
case 'd':
|
||||
log_debug = 1;
|
||||
break;
|
||||
case 'C':
|
||||
createdefault = 1;
|
||||
break;
|
||||
|
|
|
@ -621,6 +621,13 @@ void tvhlog_spawn(int severity, const char *subsys, const char *fmt, ...);
|
|||
#define LOG_INFO 6 /* informational */
|
||||
#define LOG_DEBUG 7 /* debug-level messages */
|
||||
|
||||
extern int log_debug;
|
||||
|
||||
#define DEBUGLOG(subsys, fmt...) do { \
|
||||
if(log_debug) \
|
||||
tvhlog(LOG_DEBUG, subsys, fmt); \
|
||||
} while(0)
|
||||
|
||||
|
||||
static inline int64_t
|
||||
getclock_hires(void)
|
||||
|
|
Loading…
Add table
Reference in a new issue