-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Better logging #88
Comments
* Add logging utils and "QuantumProgram.set_verbose" Add the basis for being able to replace the existing "print" and "verbose"/"silent" flags with standard logging messages: * add a `qiskit._logging` module that contains two convenience functions for setting up the loggers (format, handlers) to be used by the SDK, defaulting to sensible values. * add `QuantumProgram.enable_logs()` and `disable_logs()` as the single point of entry for setting/unsetting the verbosity of the output. * Remove silent and verbose arguments, adjust tests Remove the `silent` and `verbose` arguments on the codebase, and change the `print` statements into `logger.info` statements in the main modules and into `logger.debug` at `qiskit.mapper` due to the verbosity of the output. Adjust the tests accordingly. Note that the `qiskit.tools` module has not been updated, and that in some cases `print(a,b)` had to be converted into `logger.info("%s%s" % (a, b))` as the calls expect the full string to be passed as the first parameter. * Add note about logging on sphinx documentation * Revise log calls to pass the args directly Modify `log.info('some %s' % thing)` to `log.info('some %s', thing)` in order to avoid introducing linting warnings. * Fix typo on documentation for logging * Simple format for INFO, revert get_execution_list Use a custom formatter "SimpleInfoFormatter" on the logging configuration enabled by "QuantumProgram.enable_logs()" that makes the INFO messages displayed in a simple format (no timestamp or module information). The rest of the levels retain the previous formatting. Revert QuantumProgram.get_execution_list() to using print statements, on the principle that it will be only be used during interactive sessions.
What's the status of this? I see a commit from @ewinston but it's not assigned to anyone. I'd be happy to work on it if nobody else is. |
Hi @hellmersjl3ds, |
Not every
Currently, the testsuite do not print any of these issues (I think, it could be that the output is captured in some cases). For sure, tests are needed when performing many of these changes. This is a very nice opportunity for a first contribution. If anybody wants to work with it and need assistance, let me know! (<- @hellmersjl3ds) |
The problem of using
We are building an SDK, so using |
Some of the prints I mentioned are messages for an exception, for example. |
Hey guys, unfortunately I'm busy with another project for the next 5 weeks or so, so I won't be able to get to this before then. |
Ok, so after some PRs... we have included the logging system and we have removed all |
* moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac.
* moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac. * Create community_qiskit.rst * Revert "Create community_qiskit.rst" This reverts commit 5fd2cafd6d2e570488e9985f26d33a0f5088c581. * update global install instructions Motivation: to synthesize the mostly duplicate install instructions currently under each Qiskit element's doc section, which can then be removed. Direct to CONTRIBUTING files in each element's repo for instructions to build from source, since this serves a niche persona and is lengthy. Added images for steps that involve pointing and clicking through the web. Rewrote material for additional clarity.
…it#97 (Qiskit#102) * moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac. * Create community_qiskit.rst * Revert "Create community_qiskit.rst" This reverts commit 5fd2cafd6d2e570488e9985f26d33a0f5088c581. * update global install instructions Motivation: to synthesize the mostly duplicate install instructions currently under each Qiskit element's doc section, which can then be removed. Direct to CONTRIBUTING files in each element's repo for instructions to build from source, since this serves a niche persona and is lengthy. Added images for steps that involve pointing and clicking through the web. Rewrote material for additional clarity. * removed Troubleshooting section fixes Qiskit#97
* moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac. * Create community_qiskit.rst * Revert "Create community_qiskit.rst" This reverts commit 5fd2cafd6d2e570488e9985f26d33a0f5088c581. * update global install instructions Motivation: to synthesize the mostly duplicate install instructions currently under each Qiskit element's doc section, which can then be removed. Direct to CONTRIBUTING files in each element's repo for instructions to build from source, since this serves a niche persona and is lengthy. Added images for steps that involve pointing and clicking through the web. Rewrote material for additional clarity. * removed Troubleshooting section fixes Qiskit#97 * simplify the ibm q provider documentation Fixes Qiskit#86
…kit#114) * moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac. * Create community_qiskit.rst * Revert "Create community_qiskit.rst" This reverts commit 5fd2cafd6d2e570488e9985f26d33a0f5088c581. * update global install instructions Motivation: to synthesize the mostly duplicate install instructions currently under each Qiskit element's doc section, which can then be removed. Direct to CONTRIBUTING files in each element's repo for instructions to build from source, since this serves a niche persona and is lengthy. Added images for steps that involve pointing and clicking through the web. Rewrote material for additional clarity. * removed Troubleshooting section fixes Qiskit#97 * simplify the ibm q provider documentation Fixes Qiskit#86 * removed Visualizations from global ToC, honed Installing QIskit Fixes Qiskit#107 and fixes Qiskit#95
* moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac. * Create community_qiskit.rst * Revert "Create community_qiskit.rst" This reverts commit 5fd2cafd6d2e570488e9985f26d33a0f5088c581. * update global install instructions Motivation: to synthesize the mostly duplicate install instructions currently under each Qiskit element's doc section, which can then be removed. Direct to CONTRIBUTING files in each element's repo for instructions to build from source, since this serves a niche persona and is lengthy. Added images for steps that involve pointing and clicking through the web. Rewrote material for additional clarity. * removed Troubleshooting section fixes Qiskit#97 * simplify the ibm q provider documentation Fixes Qiskit#86 * removed Visualizations from global ToC, honed Installing QIskit Fixes Qiskit#107 and fixes Qiskit#95 * added Contributin to Qiskit fixes Qiskit#112
* moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac. * Create community_qiskit.rst * Revert "Create community_qiskit.rst" This reverts commit 5fd2cafd6d2e570488e9985f26d33a0f5088c581. * update global install instructions Motivation: to synthesize the mostly duplicate install instructions currently under each Qiskit element's doc section, which can then be removed. Direct to CONTRIBUTING files in each element's repo for instructions to build from source, since this serves a niche persona and is lengthy. Added images for steps that involve pointing and clicking through the web. Rewrote material for additional clarity. * removed Troubleshooting section fixes Qiskit#97 * simplify the ibm q provider documentation Fixes Qiskit#86 * removed Visualizations from global ToC, honed Installing QIskit Fixes Qiskit#107 and fixes Qiskit#95 * added Contributin to Qiskit fixes Qiskit#112 * remove Aer install instructions fixes Qiskit#84 * Have the ToC do the work, instead of a landing page for Getting Started. fixes Qiskit#84
* moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac. * Create community_qiskit.rst * Revert "Create community_qiskit.rst" This reverts commit 5fd2cafd6d2e570488e9985f26d33a0f5088c581. * update global install instructions Motivation: to synthesize the mostly duplicate install instructions currently under each Qiskit element's doc section, which can then be removed. Direct to CONTRIBUTING files in each element's repo for instructions to build from source, since this serves a niche persona and is lengthy. Added images for steps that involve pointing and clicking through the web. Rewrote material for additional clarity. * removed Troubleshooting section fixes Qiskit#97 * simplify the ibm q provider documentation Fixes Qiskit#86 * removed Visualizations from global ToC, honed Installing QIskit Fixes Qiskit#107 and fixes Qiskit#95 * added Contributin to Qiskit fixes Qiskit#112 * remove Aer install instructions fixes Qiskit#84 * Have the ToC do the work, instead of a landing page for Getting Started. fixes Qiskit#84 * circuit drawing style in Getting Started begins to address Qiskit#98 * adopting the term of art 'quantum cloud services'
* moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac. * Create community_qiskit.rst * Revert "Create community_qiskit.rst" This reverts commit 5fd2cafd6d2e570488e9985f26d33a0f5088c581. * update global install instructions Motivation: to synthesize the mostly duplicate install instructions currently under each Qiskit element's doc section, which can then be removed. Direct to CONTRIBUTING files in each element's repo for instructions to build from source, since this serves a niche persona and is lengthy. Added images for steps that involve pointing and clicking through the web. Rewrote material for additional clarity. * removed Troubleshooting section fixes Qiskit#97 * simplify the ibm q provider documentation Fixes Qiskit#86 * removed Visualizations from global ToC, honed Installing QIskit Fixes Qiskit#107 and fixes Qiskit#95 * added Contributin to Qiskit fixes Qiskit#112 * remove Aer install instructions fixes Qiskit#84 * Have the ToC do the work, instead of a landing page for Getting Started. fixes Qiskit#84 * circuit drawing style in Getting Started begins to address Qiskit#98 * adopting the term of art 'quantum cloud services' * getting_started references wrong circuit drawing PNG file Fixes Qiskit#129
* moved Aer tutorial images to /docs/images/figures/ and all references to these images * Have Makefile point to correct Aqua and Chemistry directories Fixes Qiskit#88 * Revert "Have Makefile point to correct Aqua and Chemistry directories" This reverts commit fee13ba87e1888c88a997430ee0a57969a9985ac. * Create community_qiskit.rst * Revert "Create community_qiskit.rst" This reverts commit 5fd2cafd6d2e570488e9985f26d33a0f5088c581. * update global install instructions Motivation: to synthesize the mostly duplicate install instructions currently under each Qiskit element's doc section, which can then be removed. Direct to CONTRIBUTING files in each element's repo for instructions to build from source, since this serves a niche persona and is lengthy. Added images for steps that involve pointing and clicking through the web. Rewrote material for additional clarity. * removed Troubleshooting section fixes Qiskit#97 * simplify the ibm q provider documentation Fixes Qiskit#86 * removed Visualizations from global ToC, honed Installing QIskit Fixes Qiskit#107 and fixes Qiskit#95 * added Contributin to Qiskit fixes Qiskit#112 * remove Aer install instructions fixes Qiskit#84 * Have the ToC do the work, instead of a landing page for Getting Started. fixes Qiskit#84 * circuit drawing style in Getting Started begins to address Qiskit#98 * adopting the term of art 'quantum cloud services' * getting_started references wrong circuit drawing PNG file Fixes Qiskit#129 * Add instructions on how to create a provider fixes Qiskit#123 * fix a typo in contributing_to_qiskit.rst * update instructions on how to create a provider addressing review by @yaelbh * ipython3 to python code blocks
Welcome contributors!
So far, we've been using a flag called "silent" (you can search for it into the sources), that if set to true, will cause some information to be printed out to the standard output.
We want to change it!
So if you are willing to contribute to this amazing project (I know you are!), I'd suggest you to start with something simple like this issue.
We want to change all the "silent" flag behavior with a more robust and standard logging solution based in the python logging facility. So basically these are the tasks we need to address:
Incorporate standard python logging module
Create a logging config file with decent default settings:
Loggers should be at module level and use the
__name__
attribute:logger = logging.getLogger(__name__)
Remove "silent" flag everywhere and replace the print() statements with logger.debug() (we don't want to show messages by default)
Suggestions are welcome! :)
Notes
Current Behavior
We are using the "silent" variable to print out information via standard output in just some modules. We want to remove them all and use a common logging system.
The text was updated successfully, but these errors were encountered: