Skip to content

Commit

Permalink
PDSM-871 review comments; stop print in log line creation; multiline …
Browse files Browse the repository at this point in the history
…output refactor
  • Loading branch information
susana-zhou1 committed Jan 14, 2025
1 parent 03129fb commit 9cc4ad7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion spine_aws_common/log/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ class LoggingConstants:
LFR_OPERATIONS: "spinevfmoperations",
LFR_AUDIT: "spinevfmaudit",
LFR_CRASHDUMP: "spinevfmcrashdump",
LFR_CONSOLE: "spinevfmconsole",
LFR_NMS: "spinevfmmonitor",
LFR_PID: "spinevfmpid",
}

LOGGING_DIRECTORIES = [LFR_AUDIT, LFR_OPERATIONS, LFR_CRASHDUMP, LFR_NMS, LFR_PID]
LOGGING_DIRECTORIES = [LFR_AUDIT, LFR_OPERATIONS, LFR_CRASHDUMP, LFR_CONSOLE, LFR_NMS, LFR_PID]

TRACE = 8
DEBUG = 7
Expand Down
8 changes: 4 additions & 4 deletions spine_aws_common/log/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ def create_log_line(log_preamble, log_text, substitution_dict, log_index=None):
try:
log_line = log_preamble + log_index + " - " + log_text.format(**substitution_dict)
except KeyError as err:
log_line = log_preamble + " - " + log_text + " - "
log_line = log_preamble + log_index +" - " + log_text + " - "
log_line += "No substitution due to KeyError, missing keys: "
log_line += str(list(err.args))
log_line += ", dictionary of "
log_line += str(substitution_dict)
print("Substitution failure - fail build: " + log_line)
log_line = "Substitution failure - fail build: " + log_line
except UnicodeError:
decode_dict = _decode_unicode_dictionary(substitution_dict)
log_line = log_preamble + " - " + log_text.format(**decode_dict)
log_line = log_preamble + log_index + " - " + log_text.format(**decode_dict)

# Replace newlines with spaces
log_line = re.sub(r"\n|\r", " ", log_line)
log_line = log_line.replace("\n", "\r")
return log_line


Expand Down

0 comments on commit 9cc4ad7

Please sign in to comment.