Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

move various print() to a proper logging mechanism #144

Open
p1-bmu opened this issue May 21, 2021 · 2 comments
Open

move various print() to a proper logging mechanism #144

p1-bmu opened this issue May 21, 2021 · 2 comments
Assignees

Comments

@p1-bmu
Copy link
Contributor

p1-bmu commented May 21, 2021

Various print() exists throughout pycrate, that should be moved to a proper logging mechanism, in order to not eventually pollute stdout. All logging should be done with the log() function in ./pycrate_core/utils.py, and this log function should do a proper logging instead of just a print.
This should apply to all part of the library, except the pycrate_corenet part which has already a specific handling for logs, and the tools which have to print.

Places where explicit print() should be changed to log():

  • ./pycrate_ether/IP.py
@p1-bmu p1-bmu assigned p1-bmu and unassigned p1-bmu May 21, 2021
@benmaddison
Copy link

Various print() exists throughout pycrate, that should be moved to a proper
logging mechanism, in order to not eventually pollute stdout. All logging
should be done with the log() function in ./pycrate_core/utils.py, and
this log function should do a proper logging instead of just a print.

It's more work, but better to call log(...) directly in the module where the event occurs.

The reason for this is with the boilerplate (in every module):

import logging

log = logging.getLogger(__name__)

Then the log object will have a name matching the name of the module, which
makes it easy to see where in the library the message was generated.

If you centralise the call, everything will look like it came from pycrate_core.utils

@p1-bmu
Copy link
Contributor Author

p1-bmu commented May 25, 2021

Yes, I realize this while reading the logging module doc and tested it.
This will require changes in many files : I'll do it when I a have proper time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants