Skip to content

Commit

Permalink
[SDK/CLI] Fix circular import error for sdk/cli logger (#1585)
Browse files Browse the repository at this point in the history
# Description

Please add an informative description that covers that changes made by
the pull request and link all relevant issues.

# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.
  • Loading branch information
0mza987 committed Dec 25, 2023
1 parent 3ecbec6 commit 15d2dae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/promptflow/promptflow/_utils/logger_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from typing import List, Optional

from promptflow._constants import PF_LOGGING_LEVEL
from promptflow._sdk._constants import LOGGER_NAME
from promptflow._utils.credential_scrubber import CredentialScrubber
from promptflow._utils.exception_utils import ExceptionPresenter
from promptflow.contracts.run_mode import RunMode
Expand Down Expand Up @@ -370,4 +369,7 @@ def _add_handler(logger: logging.Logger, verbosity: int, target_stdout: bool = F
def get_cli_sdk_logger():
"""Get logger used by CLI SDK."""
# cli sdk logger default logging level is WARNING
return LoggerFactory.get_logger(LOGGER_NAME, verbosity=logging.WARNING)
# here the logger name "promptflow" is from promptflow._sdk._constants.LOGGER_NAME,
# to avoid circular import error, use plain string here instead of importing from _constants
# because this function is also called in _prepare_home_dir which is in _constants
return LoggerFactory.get_logger("promptflow", verbosity=logging.WARNING)

0 comments on commit 15d2dae

Please sign in to comment.