Comments (7)
Hi @hellmersjl3ds,
Thanks for offering to have a look at this. In PR#108, referenced in this PR, the python logging facility was setup and covers most of the features requested in this enhancement. One thing I think that remains to be done, however, is that the facility has not been applied everywhere (there are still print
statements for instance). If you could help make the logging uniform or suggest any other improvements that would be great. For extensive changes you could open a new issue for discussion or continue using this one.
from qiskit.
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.
from qiskit.
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.
from qiskit.
Not every print
call in the code should be replaced by log
. Some of them need a thought. Following, a list of files in 0.4, with print
s in it, and some comments for some of the cases:
qiskit/tools/visualization.py
qiskit/tools/qi/qi.py
qiskit/tools/qi/pauli.py
qiskit/tools/apps/optimization.py
qiskit/unroll/_printerbackend.py
(probably makes sense to add afile
parameter, a la build-inprint
)qiskit/qasm/_qasmlexer.py
: the print call int_error
maybe is an Exception (?)qiskit/qasm/_node/*.py
: Many prints happen into_string
methods. This method should return a string instead of printing (maybe should be called__str__
)qiskit//qasm/_qasmparser.py
: The exception should be re-raised.
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)
from qiskit.
Not every
log
.
The problem of using print()
statements, is that it forces the user to dump something to the stdout (usually the monitor), but this is not true for many other uses cases that printing to stdout doesn't make any sense like:
- Graphics User Interfaces (Windows apps, Mac apps, XWindows apps)
- Non-Attended devices
- *nix Daemons and Services
- ... and probably many others I'm not aware of...
We are building an SDK, so using print()
is killing many use-cases we don't really want to kill.
So, basically, yes, we should replace al the prints
in the code by log
:)
Notice that our logger can dump to stdout like print
always does, if the user requires to do so... not sure if we are exposing this functionality to the user at the moment, though.
from qiskit.
Some of the prints I mentioned are messages for an exception, for example.
from qiskit.
Ok, so after some PRs... we have included the logging system and we have removed all silent
flags.
Still need to remove all presence of print() in the code, but we will create another issue to address this specific issue.
I'm going to close this Issue.
from qiskit.
Related Issues (20)
- Pip information missing home-page and author information for Qiskit 1.0.2 HOT 4
- DAG `node._node_id` should be public HOT 3
- KeyError: 'cr' when loading a circuit containing c_if using qpy HOT 3
- ValueError: too many subscripts in einsum for a circuit containing controlled RZXGate HOT 2
- Invalid param type <class 'numpy.ndarray'> for gate unitary*1 HOT 1
- DAGCircuitError: 'bit mapping invalid: expected 1, got 2' for SXGate with reverse_ops after qpy roundtrip
- QPY serialization inconsistency for a circuit containing U2Gate.power().control()
- Scheduling stage doesn't use custom dt when target provided HOT 7
- Constructing Target with if_else gives KeyError HOT 1
- Add `SXGate` to supported gates in `TwoLocal` circuits HOT 1
- Port TwoQubitBasisDecomposition to Rust
- Port XXDecomposer to Rust
- Expand unitary synthesis plugin interface to support synthesizing batches of unitary matrices
- Add parallel synthesis interface to default unitary synthesis plugin
- Port TwoQubitWeylDecomposition to Rust
- MPL drawer hangs on dynamic circuits when fold=-1 HOT 1
- Cannot convert a teleportation circuit to QASM3
- Cannot name a QuantumRegister with the same name as a ClassicalRegister HOT 1
- QuantumCircuit.depth() can't handle classical expressions properly HOT 1
- typo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qiskit.