diff --git a/jrnl/Journal.py b/jrnl/Journal.py index 07b2e881..2512b121 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -438,6 +438,7 @@ def open_journal(journal_name, config, legacy=False): If legacy is True, it will open Journals with legacy classes build for backwards compatibility with jrnl 1.x """ + logging.debug("open_journal start") validate_journal_name(journal_name, config) config = config.copy() config["journal"] = expand_path(config["journal"]) diff --git a/jrnl/cli.py b/jrnl/cli.py index 7c692c4f..e187cc3e 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -25,6 +25,7 @@ def configure_logger(debug=False): ) logging.getLogger("parsedatetime").setLevel(logging.INFO) logging.getLogger("keyring.backend").setLevel(logging.ERROR) + logging.debug("Logging start") def cli(manual_args=None): diff --git a/jrnl/encryption/BaseEncryption.py b/jrnl/encryption/BaseEncryption.py index 78dd5cf0..af0b8621 100644 --- a/jrnl/encryption/BaseEncryption.py +++ b/jrnl/encryption/BaseEncryption.py @@ -1,5 +1,6 @@ # Copyright © 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html +import logging from abc import ABC from abc import abstractmethod @@ -11,6 +12,7 @@ from jrnl.messages import MsgText class BaseEncryption(ABC): def __init__(self, journal_name: str, config: dict): + logging.debug("BaseEncryption init") self._encoding: str = "utf-8" self._journal_name: str = journal_name self._config: dict = config diff --git a/jrnl/encryption/BasePasswordEncryption.py b/jrnl/encryption/BasePasswordEncryption.py index d25d2cd1..1315cf88 100644 --- a/jrnl/encryption/BasePasswordEncryption.py +++ b/jrnl/encryption/BasePasswordEncryption.py @@ -1,5 +1,7 @@ # Copyright © 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html +import logging + from jrnl.encryption.BaseEncryption import BaseEncryption from jrnl.exception import JrnlException from jrnl.keyring import get_keyring_password @@ -12,6 +14,7 @@ from jrnl.prompt import prompt_password class BasePasswordEncryption(BaseEncryption): def __init__(self, *args, **kwargs) -> None: + logging.debug("BasePasswordEncryption init") super().__init__(*args, **kwargs) self._attempts: int = 0 self._max_attempts: int = 3 @@ -36,6 +39,7 @@ class BasePasswordEncryption(BaseEncryption): return self._encrypt(text) def decrypt(self, text: bytes) -> str: + logging.debug("BasePasswordEncryption decrypt start") if not self.password: self._prompt_password() diff --git a/jrnl/encryption/Jrnlv1Encryption.py b/jrnl/encryption/Jrnlv1Encryption.py index 092d8ed5..bedb4106 100644 --- a/jrnl/encryption/Jrnlv1Encryption.py +++ b/jrnl/encryption/Jrnlv1Encryption.py @@ -1,6 +1,7 @@ # Copyright © 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html import hashlib +import logging from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import padding @@ -13,6 +14,7 @@ from jrnl.encryption.BasePasswordEncryption import BasePasswordEncryption class Jrnlv1Encryption(BasePasswordEncryption): def __init__(self, *args, **kwargs) -> None: + logging.debug("Jrnlv1Encryption init") super().__init__(*args, **kwargs) def _encrypt(self, _: str) -> bytes: diff --git a/jrnl/encryption/Jrnlv2Encryption.py b/jrnl/encryption/Jrnlv2Encryption.py index f66a4f16..47b3c0bc 100644 --- a/jrnl/encryption/Jrnlv2Encryption.py +++ b/jrnl/encryption/Jrnlv2Encryption.py @@ -1,6 +1,7 @@ # Copyright © 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html import base64 +import logging from cryptography.fernet import Fernet from cryptography.fernet import InvalidToken @@ -13,6 +14,7 @@ from .BasePasswordEncryption import BasePasswordEncryption class Jrnlv2Encryption(BasePasswordEncryption): def __init__(self, *args, **kwargs) -> None: + logging.debug("Jrnlv2Encryption init") # Salt is hard-coded self._salt: bytes = b"\xf2\xd5q\x0e\xc1\x8d.\xde\xdc\x8e6t\x89\x04\xce\xf8" self._key: bytes = b"" diff --git a/jrnl/encryption/NoEncryption.py b/jrnl/encryption/NoEncryption.py index 13edcec3..9c4dbf92 100644 --- a/jrnl/encryption/NoEncryption.py +++ b/jrnl/encryption/NoEncryption.py @@ -1,10 +1,13 @@ # Copyright © 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html +import logging + from jrnl.encryption.BaseEncryption import BaseEncryption class NoEncryption(BaseEncryption): def __init__(self, *args, **kwargs): + logging.debug("NoEncryption init") super().__init__(*args, **kwargs) def _encrypt(self, text: str) -> bytes: