From 4ddb7273098bee179bb77e0937e560fc0100960c Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 4 Aug 2022 09:50:48 +0300 Subject: Add anki addons --- .../share/Anki2/addons21/anki_reworked/utils/logger.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .local/share/Anki2/addons21/anki_reworked/utils/logger.py (limited to '.local/share/Anki2/addons21/anki_reworked/utils/logger.py') 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") -- cgit v1.2.3