Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Debugging WEBUI: Add 'Enable syslog', fixes #3347
  • Loading branch information
perexg committed Nov 26, 2015
1 parent f67c102 commit d1d9b8e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
36 changes: 32 additions & 4 deletions src/tvhlog.c
Expand Up @@ -536,15 +536,35 @@ 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;
return &si;
}

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)
Expand Down Expand Up @@ -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,
},
{
Expand Down
3 changes: 3 additions & 0 deletions src/webui/static/app/tvhlog.js
Expand Up @@ -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);
Expand Down

0 comments on commit d1d9b8e

Please sign in to comment.