summaryrefslogtreecommitdiff
path: root/.local/share/Anki2/addons21/anki_reworked/utils/logger.py
diff options
context:
space:
mode:
authorThanosApollo <[email protected]>2022-09-01 07:46:56 +0300
committerThanosApollo <[email protected]>2022-09-01 07:46:56 +0300
commit95853bb603efacc9890f2b86bd28b0377e448ee5 (patch)
treeb787556e8f94151d67cce064af5614978eec3888 /.local/share/Anki2/addons21/anki_reworked/utils/logger.py
parent0c89df9be987008e55c1b336489c41290653434b (diff)
Re-add anki addons
Diffstat (limited to '.local/share/Anki2/addons21/anki_reworked/utils/logger.py')
-rw-r--r--.local/share/Anki2/addons21/anki_reworked/utils/logger.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/.local/share/Anki2/addons21/anki_reworked/utils/logger.py b/.local/share/Anki2/addons21/anki_reworked/utils/logger.py
new file mode 100644
index 0000000..3c67988
--- /dev/null
+++ b/.local/share/Anki2/addons21/anki_reworked/utils/logger.py
@@ -0,0 +1,17 @@
+import os
+import logging
+# declare an empty logger class
+class EmptyLogger():
+ def debug(self, *_):
+ return None
+logger = EmptyLogger()
+# init logger
+if 'ANKI_REDESIGN_DEBUG_LOGGING' in os.environ:
+ filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "user_files", "test.log")
+ logging.basicConfig(format='%(asctime)s %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',
+ datefmt='%Y%m%d-%H:%M:%S',
+ filename=filename,
+ level=logging.DEBUG)
+ logger = logging.getLogger('anki-redesign')
+ logger.setLevel(logging.DEBUG)
+ logger.debug("Initialized anki")