summaryrefslogtreecommitdiff
path: root/src/log.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-01-13 00:57:32 +0100
committerMichael Adam <obnox@samba.org>2010-01-13 00:57:32 +0100
commitdc86ebaf28289314dbca3a4241e382c08c792655 (patch)
treedab4c5de059227b1c3675d7ee46840cf75c5ae0b /src/log.c
parentfa0c4963e9097ca5483f6d2674235a7bc8635253 (diff)
downloadtinyproxy-dc86ebaf28289314dbca3a4241e382c08c792655.tar.gz
tinyproxy-dc86ebaf28289314dbca3a4241e382c08c792655.zip
log: change internal logic to choose syslog over file logging.
Now that there is always a log file set, we just check for syslog being set to TRUE and in that case use syslog logging, file logging otherwiese. Michael
Diffstat (limited to '')
-rw-r--r--src/log.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/log.c b/src/log.c
index 0c57f83..df2c7a8 100644
--- a/src/log.c
+++ b/src/log.c
@@ -252,18 +252,18 @@ int setup_logging (void)
/* Write to a user supplied log file if it's defined. This will
* override using the syslog even if syslog is defined. */
- if (config.logf_name) {
+ if (config.syslog) {
+ if (config.godaemon == TRUE)
+ openlog ("tinyproxy", LOG_PID, LOG_DAEMON);
+ else
+ openlog ("tinyproxy", LOG_PID, LOG_USER);
+ } else {
if (open_log_file (config.logf_name) < 0) {
fprintf (stderr,
"%s: Could not create log file.\n", PACKAGE);
goto done;
}
config.syslog = FALSE; /* disable syslog */
- } else if (config.syslog) {
- if (config.godaemon == TRUE)
- openlog ("tinyproxy", LOG_PID, LOG_DAEMON);
- else
- openlog ("tinyproxy", LOG_PID, LOG_USER);
}
logging_initialized = TRUE;
@@ -284,10 +284,10 @@ void shutdown_logging (void)
return;
}
- if (config.logf_name) {
- close_log_file ();
- } else if (config.syslog) {
+ if (config.syslog) {
closelog ();
+ } else {
+ close_log_file ();
}
logging_initialized = FALSE;