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

Renamed error field and improved logging #35

Merged
merged 18 commits into from Dec 4, 2017

Conversation

jsf9k
Copy link
Member

@jsf9k jsf9k commented Nov 29, 2017

Don't merge this just yet. I'm running a test to make sure this doesn't cause errors with domain-scan.

This looks to be working, so feel free to review and merge.

This should resolve #27.

present.  I changed it so that the warn and error messages will still
be output even if the --debug is not present.
and handle_syntax error.  In addition, log output now includes the
function name, filename, and line number from where the logging
information originated.

The logging information that is printed to the console also includes a
timestamp.
  statement is made but nothing is stored in "Syntax Errors" or
  "Debug".  I remedied that.
* Further refinements to logging.  Mostly cosmetic.
Copy link
Collaborator

@IanLee1521 IanLee1521 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 to me. A few minor comments / suggestions. (hooray for single-quotes by the way! ;) )

@@ -37,10 +37,10 @@
"""
from trustymail import __version__
Copy link
Collaborator

Choose a reason for hiding this comment

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

While you're shuffling imports around, I would move this one to before the from trustymail import trustymail line below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. I'll make the change.

# A list of any errors that occurred while scanning records.
self.errors = []
# A list of any debugging information collected while scanning records.
self.debug = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a bit leery of the name .debug as that makes me think of a boolean flag more than a list... maybe .debug_info would be more descriptive?

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I'll make the change.

def handle_error(prefix, domain, error):
if hasattr(error, "message"):
if "NXDOMAIN" in error.message and prefix != "[DMARC]":
def handle_error(prefix, domain, error, syntax_error=False):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a docstring here to explain what the goal / overall effect of this custom handling is?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I intend to add docstrings everywhere in trustymail and pshtt at some point, but I'll go ahead and add one for this function.

@jsf9k
Copy link
Member Author

jsf9k commented Dec 1, 2017

@IanLee1521, thank you for the review! I'll make the changes later this afternoon, once I am free from meetings.

@jsf9k jsf9k self-assigned this Dec 2, 2017
@jsf9k
Copy link
Member Author

jsf9k commented Dec 2, 2017

@IanLee1521, I never got free of meetings yesterday so I didn't get to this until today. Please let me know if these changes satisfy your objections.



def handle_syntax_error(prefix, domain, error):
"""Convenience method for handle_error(prefix, domain, error,
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jsf9k -- Minor nit, maybe we should just say "... for handle_error(...)", to shorten the length and to work around any function signature changes later.

@jsf9k jsf9k merged commit d4bb68a into master Dec 4, 2017
@jsf9k jsf9k deleted the improvement/rename_error_field branch December 4, 2017 13:36
mcdonnnj pushed a commit that referenced this pull request Jan 23, 2023
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.

None yet

2 participants