Skip to content

Logging#140

Open
flufflycthu1u wants to merge 10 commits into
masterfrom
Logging
Open

Logging#140
flufflycthu1u wants to merge 10 commits into
masterfrom
Logging

Conversation

@flufflycthu1u

Copy link
Copy Markdown
Collaborator

Summary

Adds a logger to the project and uploads the output as an artifact. Currently logs the API response from Rescue Groups for easier debugging.

Adding Logging

To add logging to a different module add the following:

import logging
logger = logging.getLogger(__name__)

To log something use logger.debug("string") or logger.info("string")

Comment thread .github/workflows/dev.yml
uses: actions/upload-artifact@v7
with:
path: cutepets.log
retention-days: 10

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we just want to keep each log for 10 days?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a good point, I think I would set the prod and dev ones separately. The max length for a public repo is 90 days and none of these are particularly big so we could definitely bump it up a bit. I think maybe 14 days for dev and 30 or 60 for prod.
Also they can be downloaded as long as they haven't expired so we should probably try to download them in cases where we aren't going to get to the issue immediately. Although I should probably give them names that identify which run they come from.

retention-days: 14
archive: false

- name: Upload API Log artifact

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should we distinguish between prod and dev logs, or they are automatically distinguished?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The logs are per run so they only show up in the action that they are logging. We could change the settings of what gets logged according to what action is running them if we wanted though.

@patrickZWY patrickZWY left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

had some questions about what would the logs actually look like, but we should just see it work in production lol

@flufflycthu1u

Copy link
Copy Markdown
Collaborator Author

had some questions about what would the logs actually look like, but we should just see it work in production lol

You can see an example here https://github.com/codeforboston/CutePetsBoston/actions/runs/28486266324?pr=140

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