aboutsummaryrefslogtreecommitdiff
path: root/modules/channel_log
diff options
context:
space:
mode:
authorGravatar jesopo2020-01-27 23:23:20 +0000
committerGravatar jesopo2020-01-27 23:25:04 +0000
commitcc84d3c00dabfb3b4fc88aedf2144f6911caf7eb (patch)
tree5b5679fdf24d1d805f98ea40c0a023faa830375f /modules/channel_log
parentadd data_directory() func to BaseModule, to get path to data file (diff)
signature
move logs to new data_directory(), log all channels by default
Diffstat (limited to 'modules/channel_log')
-rw-r--r--modules/channel_log/__init__.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/modules/channel_log/__init__.py b/modules/channel_log/__init__.py
index cffa7271..51ad7c04 100644
--- a/modules/channel_log/__init__.py
+++ b/modules/channel_log/__init__.py
@@ -10,12 +10,11 @@ LOGS_DIRECTORY = os.path.join(ROOT_DIRECTORY, "logs")
@utils.export("channelset", utils.BoolSetting("log",
"Enable/disable channel logging"))
class Module(ModuleManager.BaseModule):
- def _log_file(self, server_name, channel_name):
- return open(os.path.join(LOGS_DIRECTORY,
- "%s%s.log" % (server_name, channel_name)), "a")
+ def _file(self, server_name, channel_name):
+ return self.data_directory("%s/%s.log" % (server_name, channel_name))
def _log(self, event, channel):
- if channel.get_setting("log", False):
- with self._log_file(str(event["server"]), str(channel)) as log:
+ if channel.get_setting("log", True):
+ with open(self._file(str(event["server"]), str(channel)), "a") as log:
timestamp = datetime.datetime.now().strftime("%x %X")
log.write("%s %s\n" % (timestamp, event["line"]))