summaryrefslogtreecommitdiff
path: root/src/logger.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/logger.py')
-rw-r--r--src/logger.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/logger.py b/src/logger.py
index 4f6768cf..4858e116 100644
--- a/src/logger.py
+++ b/src/logger.py
@@ -31,7 +31,18 @@ class Logger(object):
def __del__(self):
for opened_file in self.fds.values():
- opened_file.close()
+ if opened_file:
+ opened_file.close()
+
+ def reload_all(self):
+ """Close and reload all the file handles (on SIGHUP)"""
+ for opened_file in self.fds.values():
+ if opened_file:
+ opened_file.close()
+ log.debug('All log file handles closed')
+ for room in self.fds:
+ self.fds[room] = self.check_and_create_log_dir(room)
+ log.debug('Log handle for %s re-created', room)
def check_and_create_log_dir(self, room):
"""