diff options
| author | 2020-02-20 14:56:04 +0000 | |
|---|---|---|
| committer | 2020-02-20 14:56:04 +0000 | |
| commit | 0667ac8c5f441facf2c94a1fe9ad339c8d840bea (patch) | |
| tree | 54267c50bd49e552dae9c5b58c59ce2066dfcb26 /modules | |
| parent | silence.py's `is-silenced` export is no longer used (diff) | |
| signature | ||
add option to encrypt channel_log log files line-by-line
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/channel_log.py | 14 |
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") |
