mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
Fixes cli console log levels so Cryptographer's sensitive info is only logged in disk
This commit is contained in:
@@ -78,7 +78,7 @@ class Cryptographer:
|
|||||||
sk = sha256(unhexlify(secret)).digest()
|
sk = sha256(unhexlify(secret)).digest()
|
||||||
nonce = bytearray(12)
|
nonce = bytearray(12)
|
||||||
|
|
||||||
logger.info("Encrypting blob", sk=hexlify(sk).decode(), nonce=hexlify(nonce).decode(), blob=blob.data)
|
logger.debug("Encrypting blob", sk=hexlify(sk).decode(), nonce=hexlify(nonce).decode(), blob=blob.data)
|
||||||
|
|
||||||
# Encrypt the data
|
# Encrypt the data
|
||||||
cipher = ChaCha20Poly1305(sk)
|
cipher = ChaCha20Poly1305(sk)
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class Logger:
|
|||||||
|
|
||||||
def debug(self, msg, **kwargs):
|
def debug(self, msg, **kwargs):
|
||||||
"""
|
"""
|
||||||
Logs an ``DEBUG`` level message to stdout and file.
|
Logs a ``DEBUG`` level message to stdout and file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (:obj:`str`): the message to be logged.
|
msg (:obj:`str`): the message to be logged.
|
||||||
@@ -84,7 +84,7 @@ class Logger:
|
|||||||
|
|
||||||
def warning(self, msg, **kwargs):
|
def warning(self, msg, **kwargs):
|
||||||
"""
|
"""
|
||||||
Logs an ``WARNING`` level message to stdout and file.
|
Logs a ``WARNING`` level message to stdout and file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (:obj:`str`): the message to be logged.
|
msg (:obj:`str`): the message to be logged.
|
||||||
|
|||||||
@@ -129,10 +129,10 @@ def setup_logging(log_file_path, log_name_prefix):
|
|||||||
|
|
||||||
# Create the file logger
|
# Create the file logger
|
||||||
f_logger = logging.getLogger("{}_file_log".format(log_name_prefix))
|
f_logger = logging.getLogger("{}_file_log".format(log_name_prefix))
|
||||||
f_logger.setLevel(logging.INFO)
|
f_logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
fh = logging.FileHandler(log_file_path)
|
fh = logging.FileHandler(log_file_path)
|
||||||
fh.setLevel(logging.INFO)
|
fh.setLevel(logging.DEBUG)
|
||||||
fh_formatter = logging.Formatter("%(message)s")
|
fh_formatter = logging.Formatter("%(message)s")
|
||||||
fh.setFormatter(fh_formatter)
|
fh.setFormatter(fh_formatter)
|
||||||
f_logger.addHandler(fh)
|
f_logger.addHandler(fh)
|
||||||
|
|||||||
Reference in New Issue
Block a user