Added debug output as well as corrected output formatting in log().

This commit is contained in:
Anton Hvornum 2021-01-24 23:41:45 +01:00
parent 73191b921e
commit a58331868e
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
2 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ class luks2():
def encrypt(self, partition, password, key_size=512, hash_type='sha512', iter_time=10000, key_file=None):
# TODO: We should be able to integrate this into the main log some how.
# Perhaps post-mortem?
log(f'Encrypting {partition}', level=LOG_LEVELS.Info)
log(f'Encrypting {partition} (This might take a while)', level=LOG_LEVELS.Info)
if not key_file:
key_file = f"/tmp/{os.path.basename(self.partition.path)}.disk_pw" # TODO: Make disk-pw-file randomly unique?

View File

@ -116,5 +116,5 @@ def log(*args, **kwargs):
# Finally, print the log unless we skipped it based on level.
# We use sys.stdout.write()+flush() instead of print() to try and
# fix issue #94
sys.stdout.write(string)
sys.stdout.write(f"{string}\n")
sys.stdout.flush()