Qiskit Nature Logging Utilities.
Classes
Qiskit Nature Logging. |
- class QiskitNatureLogging[source]#
Qiskit Nature Logging.
A collection of utility methods encapsulating logging functions. The most basic use is:
import logging from qiskit_nature import logging as nature_logging nature_logging.set_levels_for_names( {"qiskit_nature": logging.DEBUG, "qiskit": logging.DEBUG})
It will print to ‘stdout’ DEBUG formatted logs, for the domains included. One can access current logging levels for domains:
from qiskit_nature import logging as nature_logging dict = nature_logging.get_levels_for_names(["qiskit_nature", "qiskit"])
The result dictionary key is the domain string and the value the logging level
Methods exist also to add, remove logging handler with formatter and one to write to a file:
import logging from qiskit_nature import logging as nature_logging nature_logging.log_to_file( {"qiskit_nature": logging.DEBUG, "qiskit": logging.DEBUG}, path="file.log", mode="w" )
If mode is not given, ‘append’ mode is used.
- add_handler(name, handler, formatter=None)[source]#
Add handler and optional formatter to a module name.
- log_to_file(names, path, mode='a')[source]#
Logs modules to file.
- Parameters:
- Returns:
The logging File handler used
- Return type: