update logging statements

This commit is contained in:
Jonathan Wren 2022-10-29 15:52:16 -07:00
parent 02cdf95de7
commit c6d52b3b61
No known key found for this signature in database
5 changed files with 7 additions and 5 deletions

View file

@ -12,15 +12,17 @@ from jrnl.messages import MsgText
class BaseEncryption(ABC): class BaseEncryption(ABC):
def __init__(self, journal_name: str, config: dict): def __init__(self, journal_name: str, config: dict):
logging.debug("BaseEncryption init") logging.debug("BaseEncryption.__init__ start")
self._encoding: str = "utf-8" self._encoding: str = "utf-8"
self._journal_name: str = journal_name self._journal_name: str = journal_name
self._config: dict = config self._config: dict = config
def encrypt(self, text: str) -> bytes: def encrypt(self, text: str) -> bytes:
logging.debug("BaseEncryption.encrypt start")
return self._encrypt(text) return self._encrypt(text)
def decrypt(self, text: bytes) -> str: def decrypt(self, text: bytes) -> str:
logging.debug("BaseEncryption.decrypt start")
if (result := self._decrypt(text)) is None: if (result := self._decrypt(text)) is None:
raise JrnlException( raise JrnlException(
Message(MsgText.DecryptionFailedGeneric, MsgStyle.ERROR) Message(MsgText.DecryptionFailedGeneric, MsgStyle.ERROR)

View file

@ -14,8 +14,8 @@ from jrnl.prompt import prompt_password
class BasePasswordEncryption(BaseEncryption): class BasePasswordEncryption(BaseEncryption):
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args, **kwargs) -> None:
logging.debug("BasePasswordEncryption init")
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
logging.debug("BasePasswordEncryption.__init__ start")
self._attempts: int = 0 self._attempts: int = 0
self._max_attempts: int = 3 self._max_attempts: int = 3
self._password: str = "" self._password: str = ""

View file

@ -14,8 +14,8 @@ from jrnl.encryption.BasePasswordEncryption import BasePasswordEncryption
class Jrnlv1Encryption(BasePasswordEncryption): class Jrnlv1Encryption(BasePasswordEncryption):
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args, **kwargs) -> None:
logging.debug("Jrnlv1Encryption init")
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
logging.debug("Jrnlv1Encryption.__init__ start")
def _encrypt(self, _: str) -> bytes: def _encrypt(self, _: str) -> bytes:
raise NotImplementedError raise NotImplementedError

View file

@ -14,12 +14,12 @@ from .BasePasswordEncryption import BasePasswordEncryption
class Jrnlv2Encryption(BasePasswordEncryption): class Jrnlv2Encryption(BasePasswordEncryption):
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args, **kwargs) -> None:
logging.debug("Jrnlv2Encryption init")
# Salt is hard-coded # Salt is hard-coded
self._salt: bytes = b"\xf2\xd5q\x0e\xc1\x8d.\xde\xdc\x8e6t\x89\x04\xce\xf8" self._salt: bytes = b"\xf2\xd5q\x0e\xc1\x8d.\xde\xdc\x8e6t\x89\x04\xce\xf8"
self._key: bytes = b"" self._key: bytes = b""
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
logging.debug("Jrnlv2Encryption.__init__ start")
@property @property
def password(self): def password(self):

View file

@ -7,7 +7,7 @@ from jrnl.encryption.BaseEncryption import BaseEncryption
class NoEncryption(BaseEncryption): class NoEncryption(BaseEncryption):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
logging.debug("NoEncryption init") logging.debug("NoEncryption.__init__ start")
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
def _encrypt(self, text: str) -> bytes: def _encrypt(self, text: str) -> bytes: