summaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-01 16:26:39 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-01 16:26:39 +0200
commit8ccba8ebfaca85017eb125c45b0f16ae358358a7 (patch)
treec359b684bbc2ef0f0e60c190628fe4ab39599055 /src/config.c
parent8e589f3a3ad74dd4409632222c589aea7c0939a5 (diff)
downloadfastd-8ccba8ebfaca85017eb125c45b0f16ae358358a7.tar
fastd-8ccba8ebfaca85017eb125c45b0f16ae358358a7.zip
Remove support for log files
syslog/journald do a much better job at organizing logs, with the additional advantage of proper log rotation. If someone really wants to have a log file for fastd, they can just redirect stderr.
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c47
1 files changed, 1 insertions, 46 deletions
diff --git a/src/config.c b/src/config.c
index e7a69c3..6360475 100644
--- a/src/config.c
+++ b/src/config.c
@@ -195,44 +195,6 @@ static bool has_peer_group_peer_dirs(const fastd_peer_group_config_t *group) {
return false;
}
-void fastd_config_add_log_file(const char *name, fastd_loglevel_t level) {
- char *name2 = strdup(name);
- char *name3 = strdup(name);
-
- char *dir = dirname(name2);
- char *base = basename(name3);
-
- char *oldcwd = get_current_dir_name();
-
- if (!chdir(dir)) {
- char *logdir = get_current_dir_name();
-
- fastd_log_file_t *file = malloc(sizeof(fastd_log_file_t));
- file->filename = malloc(strlen(logdir) + 1 + strlen(base) + 1);
-
- strcpy(file->filename, logdir);
- strcat(file->filename, "/");
- strcat(file->filename, base);
-
- file->level = level;
-
- file->next = conf.log_files;
- conf.log_files = file;
-
- if(chdir(oldcwd))
- pr_error("can't chdir to `%s': %s", oldcwd, strerror(errno));
-
- free(logdir);
- }
- else {
- pr_error("change from directory `%s' to `%s' failed: %s", oldcwd, dir, strerror(errno));
- }
-
- free(oldcwd);
- free(name2);
- free(name3);
-}
-
static void read_peer_dir(const char *dir) {
DIR *dirh = opendir(".");
@@ -533,7 +495,7 @@ void fastd_configure(int argc, char *const argv[]) {
fastd_config_handle_options(argc, argv);
- if (!conf.log_stderr_level && !conf.log_syslog_level && !conf.log_files)
+ if (!conf.log_stderr_level && !conf.log_syslog_level)
conf.log_stderr_level = FASTD_DEFAULT_LOG_LEVEL;
}
@@ -679,13 +641,6 @@ void fastd_config_release(void) {
while (conf.peers)
fastd_peer_config_delete();
- while (conf.log_files) {
- fastd_log_file_t *next = conf.log_files->next;
- free(conf.log_files->filename);
- free(conf.log_files);
- conf.log_files = next;
- }
-
while (conf.bind_addrs) {
fastd_bind_address_t *next = conf.bind_addrs->next;
free(conf.bind_addrs->bindtodev);