From: Jaroslav Kysela Date: Thu, 26 Nov 2015 16:00:36 +0000 (+0100) Subject: Debugging WEBUI: Add 'Enable syslog', fixes #3347 X-Git-Tag: v4.2.1~1459 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d1d9b8e73cf4f55408faf852896fdccbf9b37944;p=thirdparty%2Ftvheadend.git Debugging WEBUI: Add 'Enable syslog', fixes #3347 --- diff --git a/src/tvhlog.c b/src/tvhlog.c index 5c4423889..af6be4372 100644 --- a/src/tvhlog.c +++ b/src/tvhlog.c @@ -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, }, { diff --git a/src/webui/static/app/tvhlog.js b/src/webui/static/app/tvhlog.js index 1a65c36ea..bf53f9775 100644 --- a/src/webui/static/app/tvhlog.js +++ b/src/webui/static/app/tvhlog.js @@ -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);