Skip to content

Dev/logging#33

Merged
ball42 merged 15 commits intodevelopfrom
dev/logging
May 19, 2022
Merged

Dev/logging#33
ball42 merged 15 commits intodevelopfrom
dev/logging

Conversation

@matthewsphillips
Copy link
Copy Markdown
Contributor

Lock in logging changes. Logger init function and child spawner are now in bin/logger.py

Adding a child logger to nay py file in the project requires 3 lines of code:

from bin import logger
logthis = logger.setup_child_logger(__name__)
logthis.debug(f'this got logged by {__name__} child')

Then logging statements are the same syntax everywhere: logthis.info("Message to be logged.")

The app.py 'main' logger is defined with hard coded name of 'app' because (__name__) produced unwanted results.

child log statements reflect the hierarchy and filename they came from, so troubleshooting and is simplified.
example log entries:

2022-05-16 11:22:37,533 - jawa.views.log_view - INFO - this got logged by views.log_view child
2022-05-16 11:22:37,536 - jawa.views.resource_view - INFO - this got logged by views.resource_view child
2022-05-16 11:22:37,539 - jawa.views.custom_webhook - DEBUG - this got logged by views.custom_webhook child
2022-05-16 11:22:37,541 - jawa.views.webhook_view - DEBUG - this got logged by views.webhook_view child

@ball42 ball42 self-requested a review May 19, 2022 04:00
Copy link
Copy Markdown
Collaborator

@ball42 ball42 left a comment

Choose a reason for hiding this comment

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

New logging methods are working as expected 👍

@ball42 ball42 merged commit cd6e2cb into develop May 19, 2022
@ball42 ball42 deleted the dev/logging branch May 19, 2022 19:00
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.

3 participants