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

Use structured logging (GSI-557) #10

Merged
merged 11 commits into from
Jan 17, 2024

Conversation

TheByronHimes
Copy link
Member

@TheByronHimes TheByronHimes commented Jan 16, 2024

Update for template changes and use the structure logging from hexkit.
This also adds a log statement in Notifier.send_notification() to catch, log, and re-raise the errors raised in _construct_email() and SmtpClient.send_email_message().

Errors are logged in the following format:

try:
  ...
except xyz as err:
  my_error = ErrorToRaise(data="123")
  log.error(my_error, extra={"data": "123"})
  raise my_error from err

It can cause some visual clutter though. Maybe we can clean up with a new approach or convenience method in the future.

@coveralls
Copy link

coveralls commented Jan 16, 2024

Pull Request Test Coverage Report for Build 7558266363

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-4.2%) to 76.19%

Totals Coverage Status
Change from base Build 7102563998: -4.2%
Covered Lines: 160
Relevant Lines: 210

💛 - Coveralls

@TheByronHimes TheByronHimes marked this pull request as ready for review January 16, 2024 09:27
@TheByronHimes TheByronHimes marked this pull request as draft January 17, 2024 08:16
@TheByronHimes TheByronHimes marked this pull request as ready for review January 17, 2024 09:39
mephenor
mephenor previously approved these changes Jan 17, 2024
Copy link
Member

@mephenor mephenor left a comment

Choose a reason for hiding this comment

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

Looks good, I just have one comment you can act upon or just leave it as is right now.

src/ns/core/notifier.py Outdated Show resolved Hide resolved
@TheByronHimes TheByronHimes merged commit 6b2a79b into main Jan 17, 2024
8 checks passed
@TheByronHimes TheByronHimes deleted the feature/use_json_logging_GSI-557 branch January 17, 2024 16:01
@TheByronHimes TheByronHimes restored the feature/use_json_logging_GSI-557 branch January 17, 2024 16:08
@TheByronHimes TheByronHimes deleted the feature/use_json_logging_GSI-557 branch January 17, 2024 16:08
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