aboutsummaryrefslogtreecommitdiff
path: root/modules/channel_log
diff options
context:
space:
mode:
authorGravatar jesopo2020-01-27 23:26:54 +0000
committerGravatar jesopo2020-01-27 23:26:54 +0000
commit3b55e00dd060e13f6f8bc09bd16977bf06483345 (patch)
tree25c0c2decb699d133cca4aeb08cfeab04bfaf0fb /modules/channel_log
parentmove logs to new data_directory(), log all channels by default (diff)
move channel_log/__init__.py to channel_log.py
Diffstat (limited to 'modules/channel_log')
-rw-r--r--modules/channel_log/__init__.py39
-rw-r--r--modules/channel_log/logs/.keep0
2 files changed, 0 insertions, 39 deletions
diff --git a/modules/channel_log/__init__.py b/modules/channel_log/__init__.py
deleted file mode 100644
index 51ad7c04..00000000
--- a/modules/channel_log/__init__.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#--depends-on config
-#--depends-on format_activity
-
-import datetime, os.path
-from src import ModuleManager, utils
-
-ROOT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
-LOGS_DIRECTORY = os.path.join(ROOT_DIRECTORY, "logs")
-
-@utils.export("channelset", utils.BoolSetting("log",
- "Enable/disable channel logging"))
-class Module(ModuleManager.BaseModule):
- 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", 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"]))
-
- @utils.hook("formatted.message.channel")
- @utils.hook("formatted.notice.channel")
- @utils.hook("formatted.join")
- @utils.hook("formatted.part")
- @utils.hook("formatted.nick")
- @utils.hook("formatted.invite")
- @utils.hook("formatted.mode.channel")
- @utils.hook("formatted.topic")
- @utils.hook("formatted.topic-timestamp")
- @utils.hook("formatted.kick")
- @utils.hook("formatted.quit")
- @utils.hook("formatted.rename")
- @utils.hook("formatted.chghost")
- def on_formatted(self, event):
- if event["channel"]:
- self._log(event, event["channel"])
- elif event["user"]:
- for channel in event["user"].channels:
- self._log(event, channel)
diff --git a/modules/channel_log/logs/.keep b/modules/channel_log/logs/.keep
deleted file mode 100644
index e69de29b..00000000
--- a/modules/channel_log/logs/.keep
+++ /dev/null