exit(0);
}
+/**
+ * Show subsystems info
+ */
+static void
+show_subsystems(const char *argv0)
+{
+ int i;
+ tvhlog_subsys_t *ts = tvhlog_subsystems;
+ printf("Subsystems:\n\n");
+ for (i = 1, ts++; i < LS_LAST; i++, ts++) {
+ printf(" %-15s %s\n", ts->name, _(ts->desc));
+ }
+ exit(0);
+}
+
/**
*
*/
opt_dbus = 0,
opt_dbus_session = 0,
opt_nobackup = 0,
- opt_nobat = 0;
+ opt_nobat = 0,
+ opt_subsystems = 0;
const char *opt_config = NULL,
*opt_user = NULL,
*opt_group = NULL,
#if ENABLE_TRACE
{ 0, "trace", N_("Enable trace subsystems"), OPT_STR, &opt_log_trace },
#endif
+ { 0, "subsystems",N_("List subsystems"), OPT_BOOL, &opt_subsystems },
{ 0, "fileline", N_("Add file and line numbers to debug"), OPT_BOOL, &opt_fileline },
{ 0, "threadid", N_("Add the thread ID to debug"), OPT_BOOL, &opt_threadid },
#if ENABLE_LIBAV
show_usage(argv[0], cmdline_opts, ARRAY_SIZE(cmdline_opts), NULL);
if (opt_version)
show_version(argv[0]);
+ if (opt_subsystems)
+ show_subsystems(argv[0]);
}
/* Additional cmdline processing */
{"TRACE", "\033[32m"},
};
-struct logsubsystxt {
- const char *name;
- const char *desc;
-};
-
-static struct logsubsystxt logsubsys[] = {
+tvhlog_subsys_t tvhlog_subsystems[] = {
[LS_NONE] = { "<none>", N_("None") },
[LS_START] = { "START", N_("START") },
[LS_STOP] = { "STOP", N_("STOP") },
if (severity <= atomic_get(&tvhlog_level)) {
if (tvhlog_trace) {
ok = htsmsg_get_u32_or_default(tvhlog_trace, "all", 0);
- ok = htsmsg_get_u32_or_default(tvhlog_trace, logsubsys[subsys].name, ok);
+ ok = htsmsg_get_u32_or_default(tvhlog_trace, tvhlog_subsystems[subsys].name, ok);
}
if (!ok && severity == LOG_DEBUG && tvhlog_debug) {
ok = htsmsg_get_u32_or_default(tvhlog_debug, "all", 0);
- ok = htsmsg_get_u32_or_default(tvhlog_debug, logsubsys[subsys].name, ok);
+ ok = htsmsg_get_u32_or_default(tvhlog_debug, tvhlog_subsystems[subsys].name, ok);
}
}
} else {
if (options & TVHLOG_OPT_THREAD) {
tvh_strlcatf(buf, sizeof(buf), l, "tid %ld: ", (long)pthread_self());
}
- tvh_strlcatf(buf, sizeof(buf), l, "%s: ", logsubsys[subsys].name);
+ tvh_strlcatf(buf, sizeof(buf), l, "%s: ", tvhlog_subsystems[subsys].name);
if (options & TVHLOG_OPT_FILELINE && severity >= LOG_DEBUG)
tvh_strlcatf(buf, sizeof(buf), l, "(%s:%d) ", file, line);
if (args)
size_t count;
} tvhlog_limit_t;
+typedef struct {
+ const char *name;
+ const char *desc;
+} tvhlog_subsys_t;
+
/* Config */
extern int tvhlog_level;
extern htsmsg_t *tvhlog_debug;
extern char *tvhlog_path;
extern int tvhlog_options;
extern pthread_mutex_t tvhlog_mutex;
+extern tvhlog_subsys_t tvhlog_subsystems[];
/* Initialise */
void tvhlog_init ( int level, int options, const char *path );
LS_WEBUI,
LS_TIMESHIFT,
LS_SCANFILE,
- LS_TSFILE
+ LS_TSFILE,
+ LS_LAST /* keep this last */
};
/* Macros */