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

[FEAT]: Avoid writing to stdout in DeviceManager when verbose is False #319

Open
michael-hartmann opened this issue Oct 4, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request WIP Work In Progress

Comments

@michael-hartmann
Copy link

Description

Methods of the class DeviceManager in the file device_manager.py use the function print_with_timestamp to print to stdout even though the bool verbose in DeviceManager.__init__ is set to False.

Here is an example output to stdout:

python test.py
2024-10-04 09:52:04.528046+02 - Opening DeviceManager
2024-10-04 09:52:04.528153+02 - Creating Connection to SMU 1
[...]
2024-10-04 10:08:33.820904+02 - Closing Connections to Devices
2024-10-04 10:08:33.821155+02 - Closing Connection to SMU 1
2024-10-04 10:08:33.822089+02 - DeviceManager Closed

Output to stdout is annoying, if your scripts are intended to be directly piped into a text file (as common on Linux) or if you need control over your terminal (e.g., you want to show progress bars).

From my point of view, the best option would be to use the logging module of Python and let the user of the library configure how and if she/he wants debugging output. Another option would be to at least don't call print_with_timestamp if verbose was set to False.

Additional Information

No response

@michael-hartmann michael-hartmann added the enhancement New feature or request label Oct 4, 2024
@nfelt14
Copy link
Collaborator

nfelt14 commented Oct 4, 2024

Related to #316

@nfelt14 nfelt14 self-assigned this Oct 10, 2024
@nfelt14 nfelt14 added the WIP Work In Progress label Nov 5, 2024
@nfelt14
Copy link
Collaborator

nfelt14 commented Nov 7, 2024

The plan is to switch over to the logging module and let users specify what level of logs they want for both stdout and the saved log file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request WIP Work In Progress
Projects
None yet
Development

No branches or pull requests

2 participants