aboutsummaryrefslogtreecommitdiffstats
path: root/slack/log.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2022-10-24 21:08:02 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:52 +0100
commite3bc88120e071eac8fabb5b02d7b509488d563e2 (patch)
treef4f7195d629e4beb2e146624575d5f9302e0ab2d /slack/log.py
parente6796bbf07a5c8ecdc3411f583814be28f163807 (diff)
downloadwee-slack-e3bc88120e071eac8fabb5b02d7b509488d563e2.tar.gz
Split into multiple files
Diffstat (limited to 'slack/log.py')
-rw-r--r--slack/log.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/slack/log.py b/slack/log.py
new file mode 100644
index 0000000..f65a095
--- /dev/null
+++ b/slack/log.py
@@ -0,0 +1,23 @@
+from enum import IntEnum
+
+import globals
+import weechat
+
+
+class LogLevel(IntEnum):
+ TRACE = 1
+ DEBUG = 2
+ INFO = 3
+ WARN = 4
+ ERROR = 5
+ FATAL = 6
+
+
+# TODO: Figure out what to do with print_error vs log
+def print_error(message: str):
+ weechat.prnt("", f"{weechat.prefix('error')}{globals.SCRIPT_NAME}: {message}")
+
+
+def log(level: LogLevel, message: str):
+ if level >= LogLevel.INFO:
+ print(level, message)