aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/channel_log.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/channel_log.py b/modules/channel_log.py
index 8344e9cd..a15d51f7 100644
--- a/modules/channel_log.py
+++ b/modules/channel_log.py
@@ -26,10 +26,16 @@ class Module(ModuleManager.BaseModule):
return self.data_directory("%s/%s.log" % (server_name, sanitised_name))
def _log(self, server, channel, line):
if self._enabled(server, channel):
- with open(self._file(str(server), str(channel)), "a") as log:
- timestamp = utils.datetime.format.datetime_human(
- datetime.datetime.now())
- log.write("%s %s\n" % (timestamp, line))
+ timestamp = utils.datetime.format.datetime_human(
+ datetime.datetime.now())
+ log_line = "%s %s" % (timestamp, line)
+
+ if "log-key" in self.bot.config:
+ log_line = "\x02%s" % utils.security.a_encrypt(
+ self.bot.config["log-key"], log_line)
+
+ with open(self._file(str(server), str(channel)), "a") as log_file:
+ log_file.write("%s\n" % log_line)
@utils.hook("formatted.message.channel")
@utils.hook("formatted.notice.channel")