-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request qiskit-community/qiskit-aqua#803 from manoelmarque…
…s/provider Refactor logging methods
- Loading branch information
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# This code is part of Qiskit. | ||
# | ||
# (C) Copyright IBM 2020. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
"""Utilities for Optimization logging.""" | ||
|
||
from typing import Optional | ||
from qiskit.aqua import (QiskitLogDomains, | ||
get_logging_level, | ||
set_logging_level) | ||
|
||
|
||
def get_qiskit_optimization_logging() -> int: | ||
""" | ||
Returns the current Qiskit Optimization logging level | ||
Returns: | ||
int: logging level | ||
""" | ||
return get_logging_level(QiskitLogDomains.DOMAIN_OPTIMIZATION) | ||
|
||
|
||
def set_qiskit_optimization_logging(level: int, filepath: Optional[str] = None) -> None: | ||
""" | ||
Updates the Qiskit Optimization logging with the appropriate logging level | ||
Args: | ||
level: minimum severity of the messages that are displayed. | ||
filepath: file to receive logging data | ||
""" | ||
set_logging_level(level, [QiskitLogDomains.DOMAIN_OPTIMIZATION], filepath) |