Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error and warning tracker (separate) #17

Merged
merged 6 commits into from
Nov 16, 2023
Merged

Conversation

ericwang1409
Copy link
Collaborator

Added the log_files_metrics function that keeps track of the error and warnings in the log files separately and prints the results.

@@ -27,6 +44,7 @@ def write_persistent_file(contents):
with open(PERSISTENT_FILE_PATH, "a") as f:
f.write(f"{contents}\n")

log_files_metrics(TEMP_FILE_LOGS)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you actually move this into close_persistent_file instead? I know I said it should be in this method, but I think it makes more sense to only run when we're closing the file instead.


with open(file, "r") as file:
for line in file:
if "ERROR" in line:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder to update this so it only checks if "ERROR" is at the beginning of the line.

elif "WARNING" in line:
warning_count += 1

print(f"Error count: {error_count}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you swap out print with write_persistent_file instead?

@AC-Dap AC-Dap merged commit aeae5ae into master Nov 16, 2023
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants