summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-03-18 19:01:40 +0100
committerHarald Welte <laforge@gnumonks.org>2013-03-18 19:05:46 +0100
commit4de854dcf00124b82c12421c3ea1f06a9edeff76 (patch)
treee892c186cdbf9d91803fdf9bba7de46151dffc07 /src
parente128f4663104ed64e33e362cff2566f36d65e658 (diff)
logging: add new log_targets_reopen() function
This function will re-open all existing log files in the application, praticularly useful for SIGHUP handlers in case of logrotate
Diffstat (limited to 'src')
-rw-r--r--src/logging.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/logging.c b/src/logging.c
index eab8bdf8..ffe6ecff 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -597,6 +597,26 @@ int log_target_file_reopen(struct log_target *target)
return 0;
}
+/*! \brief close and re-open a log file (for log file rotation) */
+int log_targets_reopen(void)
+{
+ struct log_target *tar;
+ int rc = 0;
+
+ llist_for_each_entry(tar, &osmo_log_target_list, entry) {
+ switch (tar->type) {
+ case LOG_TGT_TYPE_FILE:
+ if (log_target_file_reopen(tar) < 0)
+ rc = -1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return rc;
+}
+
/*! \brief Generates the logging command string for VTY
* \param[in] unused_info Deprecated parameter, no longer used!
*/