Skip to content

Commit

Permalink
✨ Use padding for additional lines instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jemrobinson committed Jun 20, 2024
1 parent c98ce56 commit d08520d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions data_safe_haven/exceptions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ def __init__(self, message: str | bytes):

# Log exception message as an error
logger = get_logger()
# Pad additional lines with spaces to ensure they line-up
padding = " " * 34 # date (10) + 1 + time (12) + 3 + log_level (5) + 3
message_str = message if isinstance(message, str) else message.decode("utf-8")
for line in message_str.split("\n"):
logger.error(line)
logger.error(message_str.replace("\n", f"\n{padding}"))


class DataSafeHavenCloudError(DataSafeHavenError):
Expand Down

0 comments on commit d08520d

Please sign in to comment.