]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add DEBUGLOG() macro for debuglogging (will only output if tvheadend is started with...
authorAndreas Öman <andreas@lonelycoder.com>
Sun, 7 Jun 2009 09:06:37 +0000 (09:06 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Sun, 7 Jun 2009 09:06:37 +0000 (09:06 +0000)
src/main.c
src/tvhead.h

index 7cac3c19060f7f4c063800de62e28d4a9ccab311..54a9a22cec550edd7d7e81479a9f4cd99cdd8926 100644 (file)
@@ -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;
index c0e327a99fef9a6a261170a21471df522430e0e7..421644f3699ab872280bf5c3781d716f08900a5f 100644 (file)
@@ -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)