Skip to content

Convert print() statements to logging - #4

Merged
stan-janssen merged 3 commits into
mainfrom
logging
Sep 24, 2020
Merged

stan-janssen merged 3 commits into
mainfrom
logging

Conversation

@stan-janssen

Copy link
Copy Markdown
Contributor

This pull request closes #1, and provides a better way for users of the library to deal with logs from openleadr.

Printing the fingerprint on startup to logging.INFO has two drawbacks:

1. With no default handlers, the user will not see INFO-level logging messages, which can be confusing.
2. If you don't want the fingerprint in your logs each time, there was no option to turn it off without raising the logging level.

This change will print the fingerprint to stdout by default, and this option can be turned off if so desired.
A user can also get their fingerprint using a command-line utility that they can run before running or building their client for the first time.

This is documented under Message Signing > Certificate Fingerprints.
@stan-janssen
stan-janssen merged commit 3efea9e into main Sep 24, 2020
@stan-janssen
stan-janssen deleted the logging branch December 10, 2020 09:30
Comment thread docs/logging.rst
logger = logging.getLogger('openleadr')

handler = logging.FileHandler('mylogfile.txt')
logger.addHandler(logger)

@Gr3at Gr3at Oct 29, 2021 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is a typo here logger.addHandler(handler). Consider to change this.

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.

Convert all print statements to use the Python logger

2 participants