Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtkit-daemon: Don't log debug messages by default #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions rtkit-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ static bool canary_demote_unknown = FALSE;
/* Log to stderr? */
static bool log_stderr = FALSE;

/* Also log debugging messages? */
static bool log_debug = FALSE;

/* Scheduling policy to use */
static int sched_policy = SCHED_RR;

Expand Down Expand Up @@ -1876,6 +1879,7 @@ enum {
ARG_CANARY_DEMOTE_UNKNOWN,
ARG_CANARY_REFUSE_SEC,
ARG_STDERR,
ARG_DEBUG,
ARG_INTROSPECT
};

Expand Down Expand Up @@ -1905,6 +1909,7 @@ static const struct option long_options[] = {
{ "canary-demote-unknown", no_argument, 0, ARG_CANARY_DEMOTE_UNKNOWN },
{ "canary-refuse-sec", required_argument, 0, ARG_CANARY_REFUSE_SEC },
{ "stderr", no_argument, 0, ARG_STDERR },
{ "debug", no_argument, 0, ARG_DEBUG },
{ "introspect", no_argument, 0, ARG_INTROSPECT },
{ NULL, 0, 0, 0}
};
Expand Down Expand Up @@ -1933,6 +1938,7 @@ static void show_help(const char *exe) {
" --version Show version\n\n"
"OPTIONS:\n"
" --stderr Log to STDERR in addition to syslog\n"
" --debug Also log debugging mssages\n"
" --user-name=USER Run daemon as user (%s)\n\n"
" --scheduling-policy=(RR|FIFO) Choose scheduling policy (%s)\n"
" --our-realtime-priority=[%i..%i] Realtime priority for the daemon (%u)\n"
Expand Down Expand Up @@ -2222,6 +2228,10 @@ static int parse_command_line(int argc, char *argv[], int *ret) {
log_stderr = TRUE;
break;

case ARG_DEBUG:
log_debug = TRUE;
break;

case ARG_INTROSPECT:
fputs(introspect_xml, stdout);
*ret = 0;
Expand Down Expand Up @@ -2251,6 +2261,9 @@ static int parse_command_line(int argc, char *argv[], int *ret) {
return -1;
}

if (!log_debug)
setlogmask(LOG_UPTO(LOG_INFO));

assert(our_realtime_priority >= (unsigned) sched_get_priority_min(sched_policy));
assert(our_realtime_priority <= (unsigned) sched_get_priority_max(sched_policy));

Expand Down