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

Improved logging. #49

Merged
merged 1 commit into from
May 12, 2016
Merged

Improved logging. #49

merged 1 commit into from
May 12, 2016

Conversation

mathuin
Copy link
Collaborator

@mathuin mathuin commented May 3, 2016

Existing logging is print-based and often fails to contain useful information.

Logging is now done with the logging module, with debug logs going to file and info to console. Logging levels are raised to errors for testing to minimize spam.

Existing logging is print-based and often fails to contain useful information.

Logging is now done with the logging module, with debug logs going to file and info to console.  Logging levels are raised to errors for testing to minimize spam.

# 2) Create/Get Protein and save values
try:
protein = ProteinModel.objects.get(code=code)
print ' Existing protein: ', code
logger.debug('protein exists')
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be a bit more information here about which protein exists or does not exist?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

On line 224, the logger is defined as coming from the pdb['logger'] value, which was set on line 201 from the variable which is assigned on line 198. The argument to the getLogger() call is equal to the code of the protein. That string is prefixed to all calls that logger makes, including the "protein exists" call.

The old logging output looked like this:

  Existing protein: 1XYZ

The new output looks like this:

1XYZ DEBUG    protein exists

Does that help?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that does help a lot. LGTM

@pop
Copy link
Contributor

pop commented May 4, 2016

I like moving away from [the python 2.X] printing as a form of debugging and toward a more standard logging system.
+1

@mathuin mathuin merged commit dbab884 into develop May 12, 2016
@mathuin mathuin deleted the jmt/improve-logging branch May 12, 2016 21:55
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