implement proper logging

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@179 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2004-09-05 00:03:16 +00:00
parent 57e473b61c
commit 6c4fd62040
50 changed files with 416 additions and 225 deletions

View file

@ -77,6 +77,7 @@ void pa_cmdline_help(const char *argv0) {
" -v Verbose startup\n"
" -X SECS Terminate the daemon after the last client quit and this time passed\n"
" -h Show this help\n"
" -l TARGET Specify the log target (syslog, stderr, auto)\n"
" -V Show version\n", e, cfg);
pa_xfree(cfg);
@ -97,13 +98,14 @@ struct pa_cmdline* pa_cmdline_parse(int argc, char * const argv []) {
cmdline->stay_root =
cmdline->version =
cmdline->disallow_module_loading = 0;
cmdline->fail = 1;
cmdline->fail = cmdline->auto_log_target = 1;
cmdline->quit_after_last_client_time = -1;
cmdline->log_target = -1;
buf = pa_strbuf_new();
assert(buf);
while ((c = getopt(argc, argv, "L:F:CDhfvrRVndX:")) != -1) {
while ((c = getopt(argc, argv, "L:F:CDhfvrRVndX:l:")) != -1) {
switch (c) {
case 'L':
pa_strbuf_printf(buf, "load %s\n", optarg);
@ -144,6 +146,20 @@ struct pa_cmdline* pa_cmdline_parse(int argc, char * const argv []) {
case 'X':
cmdline->quit_after_last_client_time = atoi(optarg);
break;
case 'l':
if (!strcmp(optarg, "syslog")) {
cmdline->auto_log_target = 0;
cmdline->log_target = PA_LOG_SYSLOG;
} else if (!strcmp(optarg, "stderr")) {
cmdline->auto_log_target = 0;
cmdline->log_target = PA_LOG_STDERR;
} else if (!strcmp(optarg, "auto"))
cmdline->auto_log_target = 1;
else {
pa_log(__FILE__": Invalid log target: use either 'syslog', 'stderr' or 'auto'.\n");
goto fail;
}
break;
default:
goto fail;
}