Currently, the "set log target" operation is supported only by pacmd, and the "newfile" target is only supported when it's given as a command line parameter to the daemon or in daemon.conf. In order to support all targets with different interfaces(command line, daemon.conf, pacmd, pactl), the target parsing should be centralized in pulsecore/log.c. Also, enum pa_log_target_t has PA_LOG_FD for logging to a file descriptor. When setting log target "file:PATH" or "newfile:PATH" within cli-command.c and daemon-conf.c, both of them use PA_LOG_FD points to a file descriptor. Which is not so good, because the same interface is used for two different targets. The log target interface needs to be extended by replacing PA_LOG_FD with PA_LOG_FILE and PA_LOG_NEWFILE. And if user wants to log to file, the file path is needed too. So it is better to have a pa_log_target struct. typedef struct { pa_log_target_type_t type; char *file; } pa_log_target; the pa_log_target_type_t is current enum pa_log_target_t. And pa_log_target_type_t is extended to support PA_LOG_FILE and PA_LOG_NEWFILE. On the other hand, the pa_log_set_target function needs to be changed, and a new function pa_log_target *pa_log_parse_target(const char *string) is needed. Also, it is better to add two functions pa_log_target *pa_log_target_new(pa_log_target_type_t type, const char *file) to construct new log target, and void pa_log_target_free(pa_log_target *t) to release one log target. Bugzilla - Bug 58389 https://bugs.freedesktop.org/show_bug.cgi?id=58389 Shuai Fan (2): Set log target improvement Modified pacmd to use new pa_log_set_target src/daemon/daemon-conf.c | 75 +++++---------------- src/daemon/daemon-conf.h | 3 +- src/daemon/main.c | 11 +-- src/pulsecore/cli-command.c | 43 ++++++------ src/pulsecore/log.c | 161 ++++++++++++++++++++++++++++++++++++++++++-- src/pulsecore/log.h | 22 ++++-- 6 files changed, 217 insertions(+), 98 deletions(-) -- 1.8.1.3