]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Debugging WEBUI: Add 'Enable syslog', fixes #3347
authorJaroslav Kysela <perex@perex.cz>
Thu, 26 Nov 2015 16:00:36 +0000 (17:00 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 26 Nov 2015 16:02:37 +0000 (17:02 +0100)
src/tvhlog.c
src/webui/static/app/tvhlog.js

index 5c4423889416a6edf29ddeca58a4725063dc2e99..af6be4372d80c4015c7a1c9f5bd600aca1fdf8f6 100644 (file)
@@ -536,7 +536,27 @@ tvhlog_class_tracesubs_set ( void *o, const void *v )
 }
 
 static const void *
-tvhlog_class_syslog_get ( void *o )
+tvhlog_class_enable_syslog_get ( void *o )
+{
+  static int si;
+  si = (tvhlog_options & TVHLOG_OPT_SYSLOG) ? 1 : 0;
+  return &si;
+}
+
+static int
+tvhlog_class_enable_syslog_set ( void *o, const void *v )
+{
+  pthread_mutex_lock(&tvhlog_mutex);
+  if (*(int *)v)
+    tvhlog_options |= TVHLOG_OPT_SYSLOG;
+  else
+    tvhlog_options &= ~TVHLOG_OPT_SYSLOG;
+  pthread_mutex_unlock(&tvhlog_mutex);
+  return 1;
+}
+
+static const void *
+tvhlog_class_debug_syslog_get ( void *o )
 {
   static int si;
   si = (tvhlog_options & TVHLOG_OPT_DBG_SYSLOG) ? 1 : 0;
@@ -544,7 +564,7 @@ tvhlog_class_syslog_get ( void *o )
 }
 
 static int
-tvhlog_class_syslog_set ( void *o, const void *v )
+tvhlog_class_debug_syslog_set ( void *o, const void *v )
 {
   pthread_mutex_lock(&tvhlog_mutex);
   if (*(int *)v)
@@ -622,12 +642,20 @@ const idclass_t tvhlog_conf_class = {
       .set    = tvhlog_class_path_set,
       .group  = 1,
     },
+    {
+      .type   = PT_BOOL,
+      .id     = "enable_syslog",
+      .name   = N_("Enable syslog"),
+      .get    = tvhlog_class_enable_syslog_get,
+      .set    = tvhlog_class_enable_syslog_set,
+      .group  = 1,
+    },
     {
       .type   = PT_BOOL,
       .id     = "syslog",
       .name   = N_("Debug to syslog"),
-      .get    = tvhlog_class_syslog_get,
-      .set    = tvhlog_class_syslog_set,
+      .get    = tvhlog_class_debug_syslog_get,
+      .set    = tvhlog_class_debug_syslog_set,
       .group  = 1,
     },
     {
index 1a65c36eaa7fed2bd25dc3c1568e2773e19175bf..bf53f97755fc08210b4b0da170b37fde09fb8476 100644 (file)
@@ -2,6 +2,9 @@ tvheadend.tvhlog = function(panel, index) {
 
     function onchange(form, field, nval, oval) {
        var f = form.getForm();
+       var enable_syslog = f.findField('enable_syslog');
+       var debug_syslog = f.findField('syslog');
+       debug_syslog.setDisabled(!enable_syslog.getValue() || enable_syslog.disabled);
        var trace = f.findField('trace');
        var tracesubs = f.findField('tracesubs');
        tracesubs.setDisabled(!trace.getValue() || trace.disabled);