mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-12 17:38:32 +02:00
update logging statements
This commit is contained in:
parent
02cdf95de7
commit
c6d52b3b61
5 changed files with 7 additions and 5 deletions
|
@ -12,15 +12,17 @@ from jrnl.messages import MsgText
|
|||
|
||||
class BaseEncryption(ABC):
|
||||
def __init__(self, journal_name: str, config: dict):
|
||||
logging.debug("BaseEncryption init")
|
||||
logging.debug("BaseEncryption.__init__ start")
|
||||
self._encoding: str = "utf-8"
|
||||
self._journal_name: str = journal_name
|
||||
self._config: dict = config
|
||||
|
||||
def encrypt(self, text: str) -> bytes:
|
||||
logging.debug("BaseEncryption.encrypt start")
|
||||
return self._encrypt(text)
|
||||
|
||||
def decrypt(self, text: bytes) -> str:
|
||||
logging.debug("BaseEncryption.decrypt start")
|
||||
if (result := self._decrypt(text)) is None:
|
||||
raise JrnlException(
|
||||
Message(MsgText.DecryptionFailedGeneric, MsgStyle.ERROR)
|
||||
|
|
|
@ -14,8 +14,8 @@ from jrnl.prompt import prompt_password
|
|||
|
||||
class BasePasswordEncryption(BaseEncryption):
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
logging.debug("BasePasswordEncryption init")
|
||||
super().__init__(*args, **kwargs)
|
||||
logging.debug("BasePasswordEncryption.__init__ start")
|
||||
self._attempts: int = 0
|
||||
self._max_attempts: int = 3
|
||||
self._password: str = ""
|
||||
|
|
|
@ -14,8 +14,8 @@ from jrnl.encryption.BasePasswordEncryption import BasePasswordEncryption
|
|||
|
||||
class Jrnlv1Encryption(BasePasswordEncryption):
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
logging.debug("Jrnlv1Encryption init")
|
||||
super().__init__(*args, **kwargs)
|
||||
logging.debug("Jrnlv1Encryption.__init__ start")
|
||||
|
||||
def _encrypt(self, _: str) -> bytes:
|
||||
raise NotImplementedError
|
||||
|
|
|
@ -14,12 +14,12 @@ 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""
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
logging.debug("Jrnlv2Encryption.__init__ start")
|
||||
|
||||
@property
|
||||
def password(self):
|
||||
|
|
|
@ -7,7 +7,7 @@ from jrnl.encryption.BaseEncryption import BaseEncryption
|
|||
|
||||
class NoEncryption(BaseEncryption):
|
||||
def __init__(self, *args, **kwargs):
|
||||
logging.debug("NoEncryption init")
|
||||
logging.debug("NoEncryption.__init__ start")
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def _encrypt(self, text: str) -> bytes:
|
||||
|
|
Loading…
Add table
Reference in a new issue