mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-12 17:38:32 +02:00
add some more logging
This commit is contained in:
parent
11605af458
commit
02cdf95de7
7 changed files with 15 additions and 0 deletions
|
@ -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
|
If legacy is True, it will open Journals with legacy classes build for
|
||||||
backwards compatibility with jrnl 1.x
|
backwards compatibility with jrnl 1.x
|
||||||
"""
|
"""
|
||||||
|
logging.debug("open_journal start")
|
||||||
validate_journal_name(journal_name, config)
|
validate_journal_name(journal_name, config)
|
||||||
config = config.copy()
|
config = config.copy()
|
||||||
config["journal"] = expand_path(config["journal"])
|
config["journal"] = expand_path(config["journal"])
|
||||||
|
|
|
@ -25,6 +25,7 @@ def configure_logger(debug=False):
|
||||||
)
|
)
|
||||||
logging.getLogger("parsedatetime").setLevel(logging.INFO)
|
logging.getLogger("parsedatetime").setLevel(logging.INFO)
|
||||||
logging.getLogger("keyring.backend").setLevel(logging.ERROR)
|
logging.getLogger("keyring.backend").setLevel(logging.ERROR)
|
||||||
|
logging.debug("Logging start")
|
||||||
|
|
||||||
|
|
||||||
def cli(manual_args=None):
|
def cli(manual_args=None):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Copyright © 2012-2022 jrnl contributors
|
# Copyright © 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
import logging
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ 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")
|
||||||
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
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# Copyright © 2012-2022 jrnl contributors
|
# Copyright © 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
import logging
|
||||||
|
|
||||||
from jrnl.encryption.BaseEncryption import BaseEncryption
|
from jrnl.encryption.BaseEncryption import BaseEncryption
|
||||||
from jrnl.exception import JrnlException
|
from jrnl.exception import JrnlException
|
||||||
from jrnl.keyring import get_keyring_password
|
from jrnl.keyring import get_keyring_password
|
||||||
|
@ -12,6 +14,7 @@ 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)
|
||||||
self._attempts: int = 0
|
self._attempts: int = 0
|
||||||
self._max_attempts: int = 3
|
self._max_attempts: int = 3
|
||||||
|
@ -36,6 +39,7 @@ class BasePasswordEncryption(BaseEncryption):
|
||||||
return self._encrypt(text)
|
return self._encrypt(text)
|
||||||
|
|
||||||
def decrypt(self, text: bytes) -> str:
|
def decrypt(self, text: bytes) -> str:
|
||||||
|
logging.debug("BasePasswordEncryption decrypt start")
|
||||||
if not self.password:
|
if not self.password:
|
||||||
self._prompt_password()
|
self._prompt_password()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright © 2012-2022 jrnl contributors
|
# Copyright © 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import logging
|
||||||
|
|
||||||
from cryptography.hazmat.backends import default_backend
|
from cryptography.hazmat.backends import default_backend
|
||||||
from cryptography.hazmat.primitives import padding
|
from cryptography.hazmat.primitives import padding
|
||||||
|
@ -13,6 +14,7 @@ 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)
|
||||||
|
|
||||||
def _encrypt(self, _: str) -> bytes:
|
def _encrypt(self, _: str) -> bytes:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright © 2012-2022 jrnl contributors
|
# Copyright © 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
import base64
|
import base64
|
||||||
|
import logging
|
||||||
|
|
||||||
from cryptography.fernet import Fernet
|
from cryptography.fernet import Fernet
|
||||||
from cryptography.fernet import InvalidToken
|
from cryptography.fernet import InvalidToken
|
||||||
|
@ -13,6 +14,7 @@ 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""
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
# Copyright © 2012-2022 jrnl contributors
|
# Copyright © 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
import logging
|
||||||
|
|
||||||
from jrnl.encryption.BaseEncryption import BaseEncryption
|
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")
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def _encrypt(self, text: str) -> bytes:
|
def _encrypt(self, text: str) -> bytes:
|
||||||
|
|
Loading…
Add table
Reference in a new issue